diff options
Diffstat (limited to 'xc')
419 files changed, 19949 insertions, 10905 deletions
diff --git a/xc/config/cf/FreeBSD.cf b/xc/config/cf/FreeBSD.cf index bba0c012f..6b8f994e6 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.106 2001/03/02 23:01:27 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/FreeBSD.cf,v 3.108 2001/04/19 19:54:41 dawes Exp $ #ifndef UseElfFormat #define UseElfFormat DefaultToElfFormat @@ -130,6 +130,15 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe #endif /* + * 2.2.x has perl 4 by default, not perl 5. + */ +#if (OSMajorVersion <= 2) +#ifndef HasPerl5 +#define HasPerl5 NO +#endif +#endif + +/* * Add an LD_LIBRARY_PATH environment variable, defined by $(CLIENTENVSETUP), * when building X to avoid that for each client ld give the message * @@ -452,7 +461,7 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe # define PreIncDir /usr/include #endif -#define TroffCmd groff -Tps +#define HasGroff YES #define NroffCmd groff -Tascii #define SetTtyGroup YES diff --git a/xc/config/cf/Imake.cf b/xc/config/cf/Imake.cf index d68043095..08270fe2e 100644 --- a/xc/config/cf/Imake.cf +++ b/xc/config/cf/Imake.cf @@ -17,13 +17,21 @@ XCOMM $Xorg: Imake.cf,v 1.4 2000/08/17 19:41:45 cpqbld Exp $ * * 4. Create a .cf file with the name given by MacroFile. */ -XCOMM $XFree86: xc/config/cf/Imake.cf,v 3.64 2001/01/17 16:22:29 dawes Exp $ +XCOMM $XFree86: xc/config/cf/Imake.cf,v 3.67 2001/04/18 17:13:58 dawes Exp $ #if defined(__APPLE__) # undef __APPLE__ # define MacroIncludeFile <darwin.cf> # define MacroFile darwin.cf # define DarwinArchitecture +# ifdef __ppc__ +# define PpcDarwinArchitecture +# undef __ppc__ +# endif +# ifdef __i386__ +# define i386DarwinArchitecture +# undef __i386__ +# endif #endif #if defined(clipper) || defined(__clipper__) @@ -41,6 +49,7 @@ XCOMM $XFree86: xc/config/cf/Imake.cf,v 3.64 2001/01/17 16:22:29 dawes Exp $ #undef i386 #undef __i386__ #undef _X86_ +#undef __CYGWIN__ #endif /* CYGWIN */ #ifdef ultrix @@ -53,6 +62,7 @@ XCOMM $XFree86: xc/config/cf/Imake.cf,v 3.64 2001/01/17 16:22:29 dawes Exp $ # ifdef mips # undef mips # define MipsArchitecture +# define MipselArchitecture # endif # undef ultrix # define UltrixArchitecture @@ -567,6 +577,7 @@ XCOMM $XFree86: xc/config/cf/Imake.cf,v 3.64 2001/01/17 16:22:29 dawes Exp $ # ifdef __mips__ # undef __mips__ # define MipsArchitecture +# define MipselArchitecture # endif # ifdef __alpha # undef __alpha @@ -743,6 +754,11 @@ XCOMM Keep cpp from replacing path elements containing i486/i586/i686 # define MipsArchitecture # undef mips # undef __mips__ +# if defined(MIPSEL) || defined(_MIPSEL) +# define MipselArchitecture +# endif +# undef MIPSEL +# undef _MIPSEL # endif XCOMM for compatibility with 3.3.x # ifdef PpcArchitecture diff --git a/xc/config/cf/Imake.rules b/xc/config/cf/Imake.rules index 4aeca765f..d6b3822a3 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.93 2001/03/31 01:57:20 keithp Exp $ +XCOMM rules: $XFree86: xc/config/cf/Imake.rules,v 3.94 2001/04/26 21:27:48 dawes Exp $ /* * MACHINE-INDEPENDENT RULES; DO NOT MODIFY @@ -3254,7 +3254,7 @@ MutexDirective: targets * ObjectModuleTarget - build a module as a single object file */ #ifndef ObjectModuleTarget -#if MakeDllModules +#if MakeDllModules && DoLoadableServer #define ObjectModuleTarget(module,objects) @@\ DynamicModuleTarget(Concat(module,_drv.so), objects) #else @@ -3267,7 +3267,7 @@ NormalRelocatableTarget(Concat(module,_drv), objects) * LibraryModuleTarget */ #ifndef LibraryModuleTarget -#if MakeDllModules +#if MakeDllModules && DoLoadableServer #define LibraryModuleTarget(module,objects) @@\ NormalLibraryTarget(module, objects) @@\ DynamicModuleTarget(Concat3(lib,module,.so), objects) @@ -3281,7 +3281,7 @@ NormalLibraryTarget(module, objects) * DepLibraryModuleTarget */ #ifndef DepLibraryModuleTarget -#if MakeDllModules +#if MakeDllModules && DoLoadableServer #define DepLibraryModuleTarget(module,deplist,objects) @@\ NormalDepLibraryTarget(module, deplist, objects) @@\ DepDynamicModuleTarget(Concat3(lib,module,.so), deplist, objects) diff --git a/xc/config/cf/Imake.tmpl b/xc/config/cf/Imake.tmpl index 73f4a7547..98c022d43 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.97 2001/03/18 14:50:30 dawes Exp $ +XCOMM $XFree86: xc/config/cf/Imake.tmpl,v 3.102 2001/04/26 21:09:38 dawes Exp $ XCOMM ---------------------------------------------------------------------- /* @@ -194,6 +194,10 @@ XCOMM the platform-specific parameters - edit site.def to change #define HasPerl YES #endif +#ifndef HasPerl5 +#define HasPerl5 HasPerl +#endif + #ifndef PerlCmd #define PerlCmd perl #endif @@ -243,6 +247,10 @@ XCOMM the platform-specific parameters - edit site.def to change #endif #endif +#ifndef HasGroff +#define HasGroff NO +#endif + #ifndef HasCookieMaker #define HasCookieMaker NO #endif @@ -374,7 +382,7 @@ XCOMM the platform-specific parameters - edit site.def to change #ifndef ByteOrder #if defined(VaxArchitecture) #define ByteOrder X_LITTLE_ENDIAN -#elif defined(MipsArchitecture) && (defined(UltrixArchitecture) || defined(OSF1Architecture)) +#elif defined(MipsArchitecture) && defined(MipselArchitecture) #define ByteOrder X_LITTLE_ENDIAN #elif defined(MipsArchitecture) #define ByteOrder X_BIG_ENDIAN @@ -1229,6 +1237,12 @@ TCLIBDIR = TclLibDir #else #define DependCmd $(DEPENDSRC)/gccmakedep #endif +#elif UseCCMakeDepend +#ifdef UseInstalled /* assume BINDIR in path */ +#define DependCmd ccmakedep +#else +#define DependCmd $(DEPENDSRC)/ccmakedep +#endif #else #ifdef UseInstalled /* assume BINDIR in path */ #define DependCmd makedepend @@ -1278,7 +1292,11 @@ TCLIBDIR = TclLibDir #endif #endif #ifndef TroffCmd +#if HasGroff #define TroffCmd groff -Tps +#else +#define TroffCmd troff -Tps +#endif #endif #ifndef NroffCmd #define NroffCmd nroff @@ -1663,7 +1681,7 @@ MODLDCOMBINEFLAGS = ModuleLdCombineFlags * LOCAL_LDFLAGS contains client-specific ld flags flags set in Imakefile */ ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES) - ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(MODULE_DEFINES) $(DEPENDDEFINES) $(DEFINES) $(EXTRA_DEFINES) + ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(MODULE_DEFINES) $(DEFINES) $(EXTRA_DEFINES) CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(MODULE_CFLAGS) $(ALLDEFINES) LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) $(DEPEND_DEFINES) LDPRELIB = LdPreLib @@ -1691,7 +1709,7 @@ MODLDCOMBINEFLAGS = ModuleLdCombineFlags LDSTRIPFLAGS = LdStripFlags LDCOMBINEFLAGS = LdCombineFlags DEPENDFLAGS = DependFlags - DEPENDDEFINES = DependDefines + DEPEND_DEFINES = DependDefines XCOMM Not sure this belongs here TKLIBDIR = TkLibDir diff --git a/xc/config/cf/NetBSD.cf b/xc/config/cf/NetBSD.cf index c71f6015d..71fe3524c 100644 --- a/xc/config/cf/NetBSD.cf +++ b/xc/config/cf/NetBSD.cf @@ -2,7 +2,7 @@ XCOMM platform: $Xorg: NetBSD.cf,v 1.3 2000/08/17 19:41:46 cpqbld Exp $ -XCOMM platform: $XFree86: xc/config/cf/NetBSD.cf,v 3.92 2001/02/11 21:39:36 herrb Exp $ +XCOMM platform: $XFree86: xc/config/cf/NetBSD.cf,v 3.95 2001/04/22 08:54:03 herrb Exp $ #ifndef OSName @@ -226,7 +226,14 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe #endif #define StandardDefines -DCSRG_BASED +/* Citrus mb locale were added in 1.5P */ +#if ((OSMajorVersion > 1) || \ + (OSMajorVersion == 1 && OSMinorVersion > 5) || \ + (OSMajorVersion == 1 && OSMinorVersion == 5 && OSTeenyVersion >= 15)) +#define XawI18nDefines -DHAS_WCHAR_H -DHAS_WCTYPE_H -DNO_WIDEC_H +#else #define XawI18nDefines -DUSE_XWCHAR_STRING -DUSE_XMBTOWC +#endif #ifndef ExtraLibraries #define ExtraLibraries /**/ @@ -293,7 +300,7 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe #define NeqnCmd neqn -Tlatin1 #define NroffCmd nroff -Tlatin1 #define EqnCmd eqn -Tps -#define TroffCmd groff -Tps +#define HasGroff YES /* * To use the NetBSD Aperture driver @@ -524,6 +531,13 @@ sed 's/\.[0-9]*$$//'` #define BuildServer NO #endif +/* + * General settings for all platforms + */ #ifndef SharedLibXdmGreet #define SharedLibXdmGreet NO #endif + +#ifndef BuildHtmlManPages +#define BuildHtmlManPages NO /* We don't want HTML manpages */ +#endif diff --git a/xc/config/cf/OpenBSD.cf b/xc/config/cf/OpenBSD.cf index 2433ec460..d4411f2a2 100644 --- a/xc/config/cf/OpenBSD.cf +++ b/xc/config/cf/OpenBSD.cf @@ -1,4 +1,4 @@ -XCOMM platform: $XFree86: xc/config/cf/OpenBSD.cf,v 3.52 2001/03/03 09:52:59 herrb Exp $ +XCOMM platform: $XFree86: xc/config/cf/OpenBSD.cf,v 3.54 2001/04/22 16:28:18 herrb Exp $ XCOMM #ifndef OSName @@ -87,26 +87,6 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe #endif /* - * Multi-thread safe libs - */ -#if !defined(PpcArchitecture) && (OSMajorVersion == 2 && OSMinorVersion >= 6 || OSMajorVersion >= 3) -# define HasPosixThreads YES -# define ThreadedX YES -# define SystemMTDefines -D_REENTRANT -# if HasLibPthread -# define ThreadsLibraries -lpthread -# else -# define BuildThreadStubLibrary YES -# define NeedUIThrStubs YES -# define ThreadsCompileFlags -pthread -# define ThreadsLibraries -lc_r -# endif -#endif - -/* Set this to YES when getpwuid_r is added to libc_r */ -# define HasThreadSafeAPI NO - -/* * Compiler Features */ #define GccUsesGas YES @@ -145,64 +125,6 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe #define GccGasOption -DGCCUSESGAS #define AsmDefines -DUSE_GAS -#ifdef i386Architecture -# ifndef DefaultGcc2i386Opt -# if (OSMajorVersion == 2 && OSMinorVersion >= 3) || OSMajorVersion > 2 - /* The GCC strength-reduce bug is fixed for OpenBSD 2.3 and later */ -# define DefaultGcc2i386Opt -O2 -# endif -# endif -# define OptimizedCDebugFlags DefaultGcc2i386Opt -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -# define ServerExtraSysLibs -li386 -# define LdPostLib /**/ -# define ServerExtraDefines GccGasOption XFree86ServerDefines -# ifndef XFree86ConsoleDefines -# if OSMajorVersion == 2 && OSMinorVersion <= 8 -# define XFree86ConsoleDefines -DPCCONS_SUPPORT -DPCVT_SUPPORT -# else -# define XFree86ConsoleDefines -DWSCONS_SUPPORT -# endif -# endif -#endif - -#ifdef SparcArchitecture -# define OptimizedCDebugFlags -O2 -# define ServerOSDefines -DDDXOSINIT -# define ServerExtraDefines XFree86ServerDefines -#endif - -#ifdef AlphaArchitecture -# define OptimizedCDebugFlags -O2 -# define ServerOSDefines -DDDXOSINIT -# define ServerExtraDefines GccGasOption -D_XSERVER64 -#endif - -#ifdef ArcArchitecture -# define ServerExtraDefines GccGasOption XFree86ServerDefines -# ifndef XFree86ConsoleDefines -# define XFree86ConsoleDefines -DPCCONS_SUPPORT -# endif -#endif - -#ifdef PpcArchitecture -# define OptimizedCDebugFlags -O2 -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DDDXOSINIT -# define ServerExtraDefines GccGasOption XFree86ServerDefines -# define XkbServerDefines -DXKB_ALWAYS_USES_SOFT_REPEAT -# ifndef XFree86ConsoleDefines -# define XFree86ConsoleDefines -DWSCONS_SUPPORT -# endif -#endif /* Ppc */ - -#ifndef ServerOSDefines -# define ServerOSDefines /**/ -#endif - -#ifndef ServerExtraDefines -# define ServerExtraDefines GccGasOption -#endif - #define StandardDefines -DCSRG_BASED #define XawI18nDefines -DUSE_XWCHAR_STRING -DUSE_XMBTOWC @@ -243,16 +165,10 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe #define NeqnCmd neqn -Tlatin1 #define NroffCmd nroff -Tlatin1 #define EqnCmd eqn -Tps -#define TroffCmd groff -Tps - -/* - * To use the NetBSD Aperture driver - */ -#if defined(i386Architecture) -#ifndef HasNetBSDApertureDriver -#define HasNetBSDApertureDriver YES -#endif -#endif +#define HasGroff YES +/* Don't build HTML manual pages */ +#define BuildRman NO +#define BuildHtmlManPages NO #ifndef HasCookieMaker # define HasCookieMaker YES @@ -385,31 +301,24 @@ install:: fonts.alias @@\ */ #ifdef AlphaArchitecture -/* - * The code for an Alpha XF86_TGA server compiles, but it DOES NOT work - */ -# define BuildAlphaXF86 NO +# define OptimizedCDebugFlags -O2 +# define ServerOSDefines -DDDXOSINIT +# define ServerExtraDefines GccGasOption -D_XSERVER64 -DXFree86Server -# if BuildAlphaXF86 -# include <xf86.rules> -# endif +# define HasWeakSymbols NO - /* - * For the current ECOFF system - */ -# define HasSharedLibraries NO -# define UseElfFormat NO - /* - * For the upcoming ELF system - */ -# if 0 /* NOT YET */ -# define HasSharedLibraries YES +# if (OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 9)) # define UseElfFormat YES # endif +# if 1 +# define HasSharedLibraries NO +# define SharedLibXThrStub NO +# else /* NOT YET */ +# define HasSharedLibraries YES +# endif -# define BuildServer YES -# define XnestServer YES -# define XVirtualFramebufferServer YES + +# define XF86Server NO # define BuildDPMSLibrary NO # define BuildDPMSExt NO @@ -417,9 +326,7 @@ install:: fonts.alias @@\ # define BuildXF86DGALibrary NO # define BuildXF86DGA NO -# if BuildAlphaXF86 -# include <xfree86.cf> -# endif +# include <xfree86.cf> #endif /* AlphaArchitecture */ @@ -430,10 +337,15 @@ install:: fonts.alias @@\ #ifdef i386Architecture # ifndef DoLoadableServer -# define DoLoadableServer YES +# define DoLoadableServer YES +# endif + +/* To use the NetBSD Aperture driver */ +# ifndef HasNetBSDApertureDriver +# define HasNetBSDApertureDriver YES # endif -/* 2.7 and later will have support for setting MTRRs */ +/* 2.7 and later have support for setting MTRRs */ # ifndef HasMTRRSupport # if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion > 6) # define HasMTRRSupport YES @@ -442,6 +354,23 @@ install:: fonts.alias @@\ # endif # endif +# ifndef DefaultGcc2i386Opt +# if (OSMajorVersion == 2 && OSMinorVersion >= 3) || OSMajorVersion > 2 + /* The GCC strength-reduce bug is fixed for OpenBSD 2.3 and later */ +# define DefaultGcc2i386Opt -O2 +# endif +# endif +# define OptimizedCDebugFlags DefaultGcc2i386Opt +# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerExtraSysLibs -li386 +# define LdPostLib /**/ +# define ServerExtraDefines GccGasOption XFree86ServerDefines +# ifndef XFree86ConsoleDefines +# define XFree86ConsoleDefines -DWSCONS_SUPPORT -DPCVT_SUPPORT +# endif + +#define JoystickSupport NO + /* Support for USB Mices */ # ifndef UsbMouseSupport # if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 6) @@ -449,9 +378,8 @@ install:: fonts.alias @@\ # endif # endif -/* - * A hack to work around an optimization problem with gcc 2.95.2 - */ + +/* A hack to work around an optimization problem with gcc 2.95.2 */ # if OSMajorVersion == 2 && OSMinorVersion >= 6 # define GccOptBug295 # endif @@ -475,6 +403,9 @@ install:: fonts.alias @@\ */ # define PositionIndependentCFlags -fpic -fno-function-cse +# define HasWeakSymbols NO +# define BuildGlxExt NO +# define BuildGLXLibrary YES #endif /* Mc68020Architecture */ @@ -489,6 +420,8 @@ install:: fonts.alias @@\ # define BuildServer NO # endif +# define ServerExtraDefines -DXFree86Server + #endif /* AmigaArchitecture */ @@ -497,7 +430,6 @@ install:: fonts.alias @@\ */ #ifdef Hp300Architecture -# include <xf86.rules> # ifndef BuildServer # define BuildServer NO # endif @@ -506,6 +438,10 @@ install:: fonts.alias @@\ # define InstallFontAliases InstallFontAliasesNoComment # define UseRgbTxt NO +# define ServerExtraDefines -DXFree86Server + +#include <xfree86.cf> + #endif /* Hp300Architecture */ @@ -514,11 +450,15 @@ install:: fonts.alias @@\ */ #ifdef Mac68kArchitecture -# include <xf86.rules> + # ifndef BuildServer # define BuildServer NO # endif +# define ServerExtraDefines -DXFree86Server + +# include <xfree86.cf> + #endif /* mac68kArchitecture */ @@ -527,11 +467,14 @@ install:: fonts.alias @@\ */ #ifdef Mvme68kArchitecture -# include <xf86.rules> # ifndef BuildServer # define BuildServer NO # endif +# define ServerExtraDefines -DXFree86Server + +# include <xfree86.cf> + #endif /* Mvme68kArchitecture */ @@ -547,7 +490,7 @@ install:: fonts.alias @@\ # define BootstrapCFlags -Dsun3 # define UnalignedReferencesAllowed YES /* changes _XtCopyArgs() */ /* Note: -ansi turns off -Dmc68000 */ -# define ServerExtraDefines GccGasOption -Dmc68000 -Dmc68020 +# define ServerExtraDefines GccGasOption -Dmc68000 -Dmc68020 -DXFree86Server # ifndef Xsun24Server # define Xsun24Server NO @@ -561,16 +504,6 @@ install:: fonts.alias @@\ #define XkbServerDefines -DXKB_ALWAYS_USES_SOFT_REPEAT -#if 0 -# ifndef BuildXKB -# define BuildXKB NO -# endif - -# ifndef BuildXKBlib -# define BuildXKBlib NO -# endif -#endif - # ifndef BuildPexExt # define BuildPexExt (XsunServer || Xsun24Server) # endif @@ -599,6 +532,11 @@ install:: fonts.alias @@\ */ #ifdef ArcArchitecture +# define ServerExtraDefines GccGasOption XFree86ServerDefines +# ifndef XFree86ConsoleDefines +# define XFree86ConsoleDefines -DPCCONS_SUPPORT +# endif + # include <xfree86.cf> #endif /* ArcArchitecture */ @@ -625,34 +563,51 @@ install:: fonts.alias @@\ */ #ifdef PpcArchitecture +# define OptimizedCDebugFlags -O2 +# define XkbServerDefines -DXKB_ALWAYS_USES_SOFT_REPEAT +# ifndef XFree86ConsoleDefines +# define XFree86ConsoleDefines -DWSCONS_SUPPORT +# endif + # define UseElfFormat YES +# define HasWeakSymbols NO -# if XFree86Devel +# if XFree86Devel # define GccWarningOptions -Wall -Wpointer-arith -Wstrict-prototypes \ -Wmissing-prototypes -Wmissing-declarations \ -Wnested-externs -# else +# else # define GccWarningOptions -Wall -Wpointer-arith -# endif +# endif -# if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 8) -# ifndef DoLoadableServer -# define DoLoadableServer YES -# endif -# define DevelDrivers cirrus ati - /* Support for USB Mices */ -# define UsbMouseSupport YES -# include <xfree86.cf> +# ifndef XF86Server +# define XF86Server NO +# endif -# else /* 2.7 and earlier */ -# include <xf86.rules> -# ifndef BuildServer -# define BuildServer YES -# endif +/* Definitions for building the XFree86 server */ +# if XF86Server +# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DDDXOSINIT +# define ServerExtraDefines GccGasOption XFree86ServerDefines +# if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 8) +# ifndef DoLoadableServer +# define DoLoadableServer YES +# endif +# define DevelDrivers cirrus ati + /* Support for USB Mices */ +# define UsbMouseSupport YES +# include <xfree86.cf> + +# else /* 2.7 and earlier */ +# include <xf86.rules> +# ifndef BuildServer +# define BuildServer NO +# endif + +# define HasSharedLibraries NO +# define BuildDynamicLoading NO +# endif +# endif /* XF86Server */ -# define HasSharedLibraries NO -# define BuildDynamicLoading NO -# endif #endif /* PpcArchitecture */ /* @@ -660,20 +615,28 @@ install:: fonts.alias @@\ */ #ifdef SparcArchitecture +# define OptimizedCDebugFlags -O2 +# define ServerOSDefines -DDDXOSINIT +# define ServerExtraDefines -DAVOID_GLYPHBLT -DPIXPRIV -DXFree86Server \ + ServerSnprintfDefines DebugDefines \ + -DX_BYTE_ORDER=ByteOrder +# define BuildXF86MiscExt NO +# define BuildMITMiscExt NO + # ifndef Xsun24Server -# define Xsun24Server NO +# define Xsun24Server YES # endif # ifndef XsunServer -# define XsunServer YES +# define XsunServer YES # endif # ifndef XsunMonoServer -# define XsunMonoServer NO +# define XsunMonoServer YES # endif -#define XkbServerDefines -DXKB_ALWAYS_USES_SOFT_REPEAT +# define XkbServerDefines -DXKB_ALWAYS_USES_SOFT_REPEAT # ifndef BuildPexExt -# define BuildPexExt (XsunServer || Xsun24Server) +# define BuildPexExt (XsunServer || Xsun24Server) # endif # define BuildXF86VidModeExt NO @@ -683,7 +646,6 @@ install:: fonts.alias @@\ #endif /* SparcArchitecture */ - /* End or architecture specific section */ /* @@ -691,8 +653,51 @@ install:: fonts.alias @@\ * which can be overridden by architecture specific sections above */ +#ifndef ServerOSDefines +# define ServerOSDefines /**/ +#endif + +#ifndef ServerExtraDefines +# define ServerExtraDefines GccGasOption +#endif + +#ifndef BuildCyrillicFonts +# define BuildCyrillicFonts YES +#endif +#ifndef BuildLatin2Fonts +# define BuildLatin2Fonts YES +#endif +#ifndef UseKoi8RForCyrillic +# define UseKoi8RForCyrillic YES +#endif + +#ifndef HasWeakSymbols +# define HasWeakSymbols YES +#endif + +/* + * Multi-thread safe libs + */ +#if HasWeakSymbols == YES && (OSMajorVersion == 2 && OSMinorVersion >= 6 || OSMajorVersion >= 3) +# define HasPosixThreads YES +# define ThreadedX YES +# define SystemMTDefines -D_REENTRANT +# if HasLibPthread +# define ThreadsLibraries -lpthread +# else +# define BuildThreadStubLibrary YES +# define NeedUIThrStubs YES +# define ThreadsCompileFlags -pthread +# define ThreadsLibraries -pthread +# endif +#endif + +/* Set this to YES when getpwuid_r is added to libc_r */ +#define HasThreadSafeAPI NO + + #ifndef DoLoadableServer -#define DoLoadableServer NO +#define DoLoadableServer NO #endif #ifndef XVirtualFramebufferServer @@ -741,6 +746,10 @@ install:: fonts.alias @@\ # endif #endif +# if !defined(GccWarningOptions) +# define GccWarningOptions -Wall -Wpointer-arith +# endif + /* This must come last */ #if OSMajorVersion == 2 && OSMinorVersion >= 8 || OSMajorVersion > 2 # include <OpenBSDLib.rules> diff --git a/xc/config/cf/Server.tmpl b/xc/config/cf/Server.tmpl index 520687a9f..762c9ead7 100644 --- a/xc/config/cf/Server.tmpl +++ b/xc/config/cf/Server.tmpl @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/config/cf/Server.tmpl,v 3.17 2001/01/17 16:22:30 dawes Exp $ +XCOMM $XFree86: xc/config/cf/Server.tmpl,v 3.18 2001/04/20 15:51:15 tsi Exp $ /* * Server imakefile info - this contains any special redefinitions, etc. * that Imakefiles in the server subtree will need. @@ -55,6 +55,7 @@ SERVER_THREAD_DEFINES = XThreadsDefines ThreadTypeDefines STD_DEFINES = ServerDefines $(SERVER_THREAD_DEFINES) CDEBUGFLAGS = ServerCDebugFlags EXT_DEFINES = ExtensionDefines +OS_DEFINES = ServerOSDefines GLX_DEFINES = GlxDefines diff --git a/xc/config/cf/X11.tmpl b/xc/config/cf/X11.tmpl index 8e650f616..9f6e26fa4 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.111 2001/04/05 02:43:33 dawes Exp $ +XCOMM $XFree86: xc/config/cf/X11.tmpl,v 1.114 2001/04/23 15:53:45 dawes Exp $ /*************************************************************************** * * @@ -144,13 +144,13 @@ VENDORMANVERSION = XVendorManVersionString #endif /* Some bdf font generation details. The scripts for this require perl. */ #ifndef TruncateUCSFonts -#define TruncateUCSFonts HasPerl +#define TruncateUCSFonts HasPerl5 #endif #ifndef MaxUCSChar #define MaxUCSChar 0x3200 #endif #ifndef DerivedUCSFonts -#define DerivedUCSFonts HasPerl +#define DerivedUCSFonts HasPerl5 #endif /* These primarily control generation of derived 8-bit fonts. */ #ifndef BuildUCSFonts @@ -2520,7 +2520,7 @@ ProjectUnsharedLibReferences(XFT,Xft,$(XFTLIBSRC),XBuildLibDir) #define LdLibraryPath LD_LIBRARY_PATH #endif -#ifdef BuildXKBlib +#if BuildXKBlib XKBFILELIBSRC = $(LIBSRC)/xkbfile ProjectUnsharedLibReferences(XKBFILE,xkbfile,$(XKBFILELIBSRC),XBuildLibDir) #ifndef XkbClientDepLibs @@ -2875,7 +2875,7 @@ InstallNamedTarget(install,edir/encodings.dir,$(INSTDATFLAGS),fdir,encodings.dir #ifndef MakeBdfFontFromUCSMaster -#if HasPerl +#if HasPerl5 #define MakeBdfFontFromUCSMaster(font,enc) @@\ includes:: font-enc.bdf @@\ @@\ @@ -2889,7 +2889,7 @@ clean:: @@\ #endif #ifndef MakeTruncatedUCSBdfFont -#if HasPerl +#if HasPerl5 #define MakeTruncatedUCSBdfFont(font,trunc,name) @@\ includes:: name.bdf @@\ @@\ @@ -3033,6 +3033,14 @@ install:: deps @@\ #define InstallRoffDoc(name) InstallDoc(name,name.PS name.txt) #endif +#ifndef InstallLatexDoc +#if HasLatex +#define InstallLatexDoc(name) InstallDoc(name,name.PS) +#else +#define InstallLatexDoc(name) +#endif +#endif + #ifndef InstallHardcopyDoc #define InstallHardcopyDoc(name,deps) @@\ all:: deps @@\ diff --git a/xc/config/cf/bsdi.cf b/xc/config/cf/bsdi.cf index 25f5d300a..7688d5b7f 100644 --- a/xc/config/cf/bsdi.cf +++ b/xc/config/cf/bsdi.cf @@ -2,7 +2,7 @@ XCOMM platform: $Xorg: bsdi.cf,v 1.3 2000/08/17 19:41:47 cpqbld Exp $ -XCOMM platform: $XFree86: xc/config/cf/bsdi.cf,v 3.35 2001/01/23 23:31:48 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/bsdi.cf,v 3.36 2001/04/19 19:54:42 dawes Exp $ #ifndef OSName #define OSName DefaultOSName #endif @@ -97,7 +97,7 @@ XCOMM xf86site.def #endif #define CppCmd /usr/bin/cpp -#define TroffCmd groff -Tps +#define HasGroff YES #define MkdirHierCmd mkdir -p #define SetTtyGroup YES #define HasNdbm YES diff --git a/xc/config/cf/cygwin.cf b/xc/config/cf/cygwin.cf index dd11550f0..60242bf47 100644 --- a/xc/config/cf/cygwin.cf +++ b/xc/config/cf/cygwin.cf @@ -1,18 +1,4 @@ -XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.3 2001/01/12 19:28:24 dawes Exp $ -XCOMM -XCOMM - changes since B20 Cygwin32 release -XCOMM - avoided tons of "not in XXX directory" messages; -XCOMM - dlls are built stripped; -XCOMM - search for cpp in a default location; -XCOMM - fixed problem with missing netinet/tcp.h; -XCOMM - Added AF_UNIX socket support; -XCOMM - xterm compiles and works; -XCOMM - more libs are built as a DLLs; -XCOMM - all DLLs have different base addresses; -XCOMM - changes since B20 Cygwin32 release -XCOMM - dllwrap is used to build DLLs; -XCOMM - Plan to add WATCOM TCP headers support; -XCOMM - gcc -E is invoked instead of cpp; +XCOMM platform: $XFree86: xc/config/cf/cygwin.cf,v 3.9 2001/04/27 12:32:42 alanh Exp $ #ifndef OSName #define OSName Cygwin @@ -26,12 +12,10 @@ XCOMM - gcc -E is invoked instead of cpp; #ifndef OSMinorVersion #define OSMinorVersion 1 #endif -#ifndef OSTeenyVersion 2 -#define OSTeenyVersion +#ifndef OSTeenyVersion +#define OSTeenyVersion 8 #endif -XCOMM #define OSDefines -DSYSV -DSYSV386 - #define ProjectRoot /usr/X11R6 #define BuildServer YES @@ -40,26 +24,33 @@ XCOMM #define OSDefines -DSYSV -DSYSV386 #define UnixCpp #endif -#define HasGcc YES -#define HasGcc2 YES #define HasGcc2ForCplusplus YES #define GccUsesGas YES #define UseGas YES #define GnuCpp YES +#define BootstrapCFlags -L/lib/automode.o + #define HasShadowPasswd NO #define HasLibCrypt YES #define HasPutenv YES #define HasPoll NO #define HasShm NO +#define HasSnprintf YES +#define HasZlib YES + +/* + * Cygwin has Tcl/Tk, but you need to keep the version numbers + * of the libs in sync. These version numbers may change + * occassionally. + */ #define Hastcl YES #define Hastk YES #define TclLibName tcl80 #define TkLibName tk80 + #define HasSockets YES #define GzipFontCompression YES -#define BuildXKB YES -#define BuildXF86MiscExt YES -#define BuildXF86VidModeExt YES /* need -fpcc-struct-return for gcc-2.95.2 or it will fail*/ + #define SharedLibFont NO #define AvoidNullMakeCommand YES #define StripInstalledPrograms NO @@ -74,23 +65,24 @@ XCOMM #define OSDefines -DSYSV -DSYSV386 #define ExpandManNames NO #define HasDlopen NO #define HasGnuMake YES -XCOMM #define ExtraLoaderDefines DlopenHack #ifndef DefaultCCOptions #define DefaultCCOptions -Wall -#endif +#endif /* DefaultCCOptions */ #define DefaultGcc2i386Opt -O2 #define LibraryCDebugFlags -O2 #define UseGccMakeDepend YES - - +/* + * This options may depend on the state of POSIX thread + * support in Cygwin, which is improving as of 2001-04-12. + */ #define ThreadedX NO #define HasThreadSafeAPI NO + #define LnCmd ln -s #define CcCmd gcc #define CpluplusCmd c++ -fpermissive #define AsCmd as -XCOMM #define AsCmd gcc -S #define GccGasOption -DGCCUSESGAS #define AsmDefines -DUSE_GAS -DGCCUSESGAS #define LdCmd ld @@ -100,18 +92,23 @@ XCOMM #define AsCmd gcc -S #define LexCmd flex -l #define LexLib -lfl #define HasFlex YES + #define PreProcessCmd CcCmd -E -XCOMM #define StdIncDir `CcCmd --print-libgcc-file-name | sed ':libgcc.a:../../../../i586-cygwin32/include:'|sed 's,\\\\,/,g'` -XCOMM #define PostIncDir `CcCmd --print-libgcc-file-name | sed ':libgcc.a:/include:'|sed 's,\\\\,/,g'` + #define StdIncDir `CcCmd --print-libgcc-file-name | sed 's,\\\\,/,g' | sed 's,libgcc.a,../../../../i686-pc-cygwin/include,'` + #define PostIncDir `CcCmd --print-libgcc-file-name | sed 's,\\\\,/,g' | sed 's,libgcc.a,include,'` + #define LdCombineFlags -r -#define OptimizedCDebugFlags -O2 -pedantic -fno-strength-reduce -fpcc-struct-return -fvtable-thunks -m486 -#define StandardDefines -D__i386__ -DWIN32_LEAN_AND_MEAN -DX_LOCALE -D_MT -D_X86_ -D__STDC__ -DNO_TCP_H -D__CYGWIN__ -D_XOPEN_SOURCE -D_REENTRANT -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DX_SOURCE + +#define OptimizedCDebugFlags -O2 -fno-strength-reduce -fpcc-struct-return -m486 + +#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 XawI18nDefines -DUSE_XWCHAR_STRING -DUSE_XMBTOWC #define HasWChar32 YES #define StandardCppDefines -traditional StandardDefines -#define ServerOSDefines XFree86ServerDefines -DDDXTIME -DFD_SETSIZE=256 -DDXOSINIT +#define ServerOSDefines XFree86ServerDefines -DDDXTIME -DFD_SETSIZE=256 -DDXOSINIT #define XkbServerDefines -DXKB_ALWAYS_USES_SOFT_REPEAT #define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #define ConnectionFlags -DTCPCONN -DUNIXCONN @@ -120,20 +117,88 @@ XCOMM #define PostIncDir `CcCmd --print-libgcc-file-name | sed ':li #define UseRgbTxt YES #define ExtraFilesToClean *.obj *.orig *.rej junk.c *.exe *.dll *.lib *~ -/* This a must to compile for xfddx display driver, or your server will NOT work on Win32. DO NOT change to NO */ - -#define BuildSurfLibrary YES - -/* The DRM module requires Linux kernel services, thus useless for CYGWIN compilers*/ - +/* + * You'll probably want BuildDebug to be YES if you are debugging :) + */ +#define BuildDebug NO +#define XFree86Devel NO +#define BuildPexExt YES +#define BuildXinerama NO +#define BuildGlxExt YES +#define BuildXIE YES +#define BuildXF86RushExt YES +#define BuildXF86RushLibrary YES +#define BuildXInputExt YES +#define BuildXF86VidModeExt YES +#define BuildXF86DGA NO +#define BuildXvExt YES +#define BuildXF86MiscExt YES +#define BuildRender YES #define BuildXF86DRI NO #define BuildXF86DRM NO -#define BuildGlxExt YES -#define BuildXinrama YES +#define BuildXKB YES +#define BuildXCMiscExt YES +#define BuildTestExt YES +#define BuildMITMiscExt YES +#define BuildSyncExt YES +#define BuildBigReqsExt YES +#define BuildEVI YES +#define BuildXF86BigfontExt YES +#define BuildRECORD YES +#define BuildDBE YES +#define BuildFontCache YES +#define BuildLBX YES +#define BuildCup YES +#define BuildXCSecurity YES +#define BuildAppgroup YES +#define BuildShapeExt YES +#define BuildScanpci NO +#define BuildDPMS NO +#define BuildDPMSExt NO +#define DPMSDefines /**/ +#define BuildScreenSaverExt NO + +/* + * What is Plugin? + */ #define BuildPlugin NO + +/* DPS is the Adobe Display Postscript library */ +#define BuildDPS YES +#define BuildDPSLibraries YES #define BuildDPSLibrary YES -XCOMM #define GlxStaticServerLib YES -#define DoLoadableServer NO + +/* + * Doing a loadable server would probably take some extra work. + */ +#define DoLoadableServer NO + +/* + * Don't build the XFree86 server + */ +#define XF86Server NO + +/* + * Try to avoid building anything related to graphics cards + */ +#define XFShadowFB NO +#define XF24_32Bpp NO +#define XF8_16Bpp NO +#define XF8_32Bpp NO +#define XF4Bpp NO +#define XF1Bpp NO +#define XF86VgaHw NO +#define XF86FBDevHw NO +#define XF86XAA NO +#define XF86Ramdac NO +#define XF86I2C NO +#define XF86DDC NO +#define XF86RAC NO +#define XF86Int10 NO + +#define XF86AFB NO + +#define XF86CardDrivers /**/ /* Some of these man page defaults are overriden in the above OS sections */ #ifndef ManSuffix @@ -155,13 +220,19 @@ XCOMM #define GlxStaticServerLib YES # define FileManDir $(MANSOURCEPATH)5 #endif +/* we don't need -lm */ +#define MathLibrary /**/ #define TermcapLibrary -ltermcap -#define XnestServer YES -#define BuildXprint YES -#define XprtServer YES +#define XnestServer YES +#define BuildXprint YES +#define XprtServer YES #define XVirtualFramebufferServer YES -#define XWinServer YES -#define UseSmartScheduler NO +#define XWinServer YES + +/* + * Why we don't use the smart scheduler? + */ +#define UseSmartScheduler NO /* --unix option of cygwin make fools the standard MakeFlagsToShellFlags macro */ #define MakeFlagsToShellFlags(makeflags,shellcmd)\ @@ -170,4 +241,3 @@ XCOMM #define GlxStaticServerLib YES #include <cygwin.rules> #include <xfree86.cf> -/*#include <xttMod.tmpl>*/ diff --git a/xc/config/cf/cygwin.rules b/xc/config/cf/cygwin.rules index efca2c16a..fae4486c4 100644 --- a/xc/config/cf/cygwin.rules +++ b/xc/config/cf/cygwin.rules @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/config/cf/cygwin.rules,v 3.3 2001/02/13 19:19:11 dawes Exp $ +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 @@ -30,7 +30,8 @@ XCOMM $XFree86: xc/config/cf/cygwin.rules,v 3.3 2001/02/13 19:19:11 dawes Exp $ #define SharedLibgetsurf NO #define SharedLibDps YES #define SharedLibDpsTk YES - +#define NormalLibGlu YES +#define SharedLibGlu YES #ifndef SharedDataSeparation #define SharedDataSeparation NO @@ -143,15 +144,6 @@ InstallTarget(install,Concat3(lib,libname,.dll),$(INSTLIBFLAGS),$(BINDIR)) #define ProgramTargetName(target)target.exe /* - * LinkBuildBinary - export a *.exe to exports/bin. - */ -#define LinkBuildBinary(program) @@\ -all:: $(BUILDBINDIR)/program program @@\ - $(BUILDBINDIR)/program: program @@\ - RemoveFile$(@) @@\ - cd $(BUILDBINDIR) && $(CP) $(BUILDBINTOP)/$(CURRENT_DIR)/program . - -/* * LinkBuildDLL - export a .dll to exports/bin. */ #ifdef UseInstalled @@ -168,13 +160,11 @@ all:: $(BUILDBINDIR)/program program @@\ #ifndef LinkBuildBinary -#define LinkBuildBinary -all:: $(BUILDBINDIR)/ProgramTargetName(binary) ProgramTargetName(binary) @@\ - @@\ -$(BUILDBINDIR)/ProgramTargetName(binary): ProgramTargetName(binary) @@\ +#define LinkBuildBinary(program) @@\ +all:: program @@\ MakeDir($(BUILDBINDIR)) @@\ - RemoveFile($(BUILDBINDIR)/ProgramTargetName(binary))) @@\ - cd $(BUILDBINDIR) && $(LN) $(BUILDBINTOP)/$(CURRENT_DIR)/ProgramTargetName(binary) . + RemoveFile($(BUILDBINDIR)/program) @@\ + $(CP) $(BUILDBINTOP)/$(CURRENT_DIR)/program $(BUILDBINDIR) #endif /* LinkBuildBinary */ /* This is to replace an ugly hack in /xc/nls/XLC_LOCALE */ diff --git a/xc/config/cf/cygwin.tmpl b/xc/config/cf/cygwin.tmpl index ec18609cd..0a06d48dc 100644 --- a/xc/config/cf/cygwin.tmpl +++ b/xc/config/cf/cygwin.tmpl @@ -1,5 +1,5 @@ XCOMM $XConsortium: WinLib.tmpl,v 1.1 94/01/08 18:32:51 rws Exp $ -XCOMM $XFree86: xc/config/cf/cygwin.tmpl,v 3.3 2001/02/13 19:19:11 dawes Exp $ +XCOMM $XFree86: xc/config/cf/cygwin.tmpl,v 3.4 2001/04/18 17:13:58 dawes Exp $ #define SharedOldXReqs $(LDPRELIB) $(XLIBONLY) #define SharedXtReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XLIBONLY) @@ -26,6 +26,7 @@ XCOMM #define SharedXfontReqs $(LDPRELIB) $(XLIB) #define SharedDPSTKReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XTOOLLIB) $(DPSLIB) $(XLIB) #define SharedXrenderReqs $(LDPRELIB) $(EXTENSIONLIB) $(XLIB) #define SharedpsresReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XTOOLLIB) $(XLIB) +#define SharedXmuuReqs $(LDPRELIB) $(XTOOLLIB) $(XLIB) #ifndef FixupLibReferences diff --git a/xc/config/cf/darwin.cf b/xc/config/cf/darwin.cf index e101a3dce..c32d5d227 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.9 2001/03/26 02:55:59 torrey Exp $ +XCOMM $XFree86: xc/config/cf/darwin.cf,v 1.11 2001/04/16 06:51:46 torrey Exp $ /* Darwin / Mac OS X configuration by John Carmack <johnc@idsoftware.com> */ @@ -19,13 +19,17 @@ XCOMM $XFree86: xc/config/cf/darwin.cf,v 1.9 2001/03/26 02:55:59 torrey Exp $ /* * This enables some settings for developers. */ -#define XFree86Devel NO +#ifndef XFree86Devel +# define XFree86Devel NO +#endif /* * This enables Quartz compatibility. * Turn off to build on raw Darwin systems. */ -#define DarwinQuartzSupport YES +#ifndef DarwinQuartzSupport +# define DarwinQuartzSupport YES +#endif /* we don't need -lm */ #define MathLibrary /**/ @@ -67,15 +71,18 @@ XCOMM $XFree86: xc/config/cf/darwin.cf,v 1.9 2001/03/26 02:55:59 torrey Exp $ # define LibraryCCOptions DefaultCCOptions -fno-common #endif -/* A lot of xfree86 code needs __powerpc__ to avoid doing outport asm. - * +/* * __DARWIN__ will be used for platform specific #ifdefs that can't * be handled by existing X defines. * * 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 /* programs/rgb/rgb.h and others needs this */ #define HasNdbm YES @@ -88,6 +95,11 @@ XCOMM $XFree86: xc/config/cf/darwin.cf,v 1.9 2001/03/26 02:55:59 torrey Exp $ /* our custom X server */ #define XDarwinServer YES +/* Thanks to the IOKit, the X server does not have to be SetUID. */ +#ifndef InstallXserverSetUID +# define InstallXserverSetUID NO +#endif + /* pex? bah. I'm not going to bother getting the device * dependent part of this working. If I get the time, i'll * get glx working instead. @@ -97,8 +109,9 @@ XCOMM $XFree86: xc/config/cf/darwin.cf,v 1.9 2001/03/26 02:55:59 torrey Exp $ /* no direct graphics extension */ #define BuildXF86DGA NO -/* no extra tablets and weird input devices */ +/* no server support for extra tablets and weird input devices */ #define BuildXInputExt NO +#define BuildXInputLib YES /* no Display Power Management extension */ #define BuildDPMSExt NO diff --git a/xc/config/cf/kdrive.cf b/xc/config/cf/kdrive.cf index 2a9a43c4b..5b9bda671 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.8 2000/12/08 22:09:39 keithp Exp $ +XCOMM $XFree86: xc/config/cf/kdrive.cf,v 1.9 2001/04/10 16:07:47 dawes Exp $ /* * This configuration file contains all of the configuration * information for the XFree86 based X Servers. @@ -211,6 +211,12 @@ XF86COMSRC=. #endif #endif +#if defined(HasGcc2) && defined(PpcArchitecture) +#ifndef DefaultGcc2PpcOpt +#define DefaultGcc2PpcOpt -O2 +#endif +#endif + #ifndef DefaultGcc2DebugOpt #define DefaultGcc2DebugOpt -g #endif diff --git a/xc/config/cf/linux.cf b/xc/config/cf/linux.cf index 38e1275a1..d3e4762e8 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.162 2001/04/03 02:29:30 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/linux.cf,v 3.165 2001/04/19 19:54:43 dawes Exp $ #ifndef LinuxElfDefault # define LinuxElfDefault YES @@ -87,73 +87,79 @@ XCOMM libc: (LinuxCLibMajorVersion./**/LinuxCLibMinorVersion./**/LinuxCLibTeenyV XCOMM binutils: (LinuxBinUtilsMajorVersion) #if LinuxDistribution == LinuxDebian -#ifdef DebianMaintainer -#define XFree86Devel YES -#endif -#define HasTk YES -#define TkLibDir /usr/lib -#define TkIncDir /usr/include -#define TkLibName tk8.3 -#define XF86SetupUsesStaticTk NO -#define HasTcl YES -#define TclLibDir /usr/lib -#define TclIncDir /usr/include -#define TclLibName tcl8.3 -#define XF86SetupUsesStaticTcl NO +# define SystemManDirectory /usr/share/man +# define HasPam YES +# define HasTk YES +# define TkLibDir /usr/lib +# define TkIncDir /usr/include +# define TkLibName tk8.3 +# define XF86SetupUsesStaticTk NO +# define HasTcl YES +# define TclLibDir /usr/lib +# define TclIncDir /usr/include +# define TclLibName tcl8.3 +# define XF86SetupUsesStaticTcl NO /* un-comment this when it is un-broken */ -/* #define JoystickSupport YES */ -#define InstallXinitConfig YES -#define InstallXdmConfig YES -#define InstallFSConfig YES -#ifdef DebianMaintainer -#define HasXdmAuth YES -#endif -#define DebuggableLibraries YES -#define ForceNormalLib YES -#define BuildSpecsDocs YES -#define SpecsDocDirs CTEXT GL ICCCM X11 Xext Xv i18n xterm -/* right now glide only works on i386 */ -#ifdef i386Architecture -#ifdef DebianMaintainer -#define HasGlide2 YES -#endif -#define Glide2IncDir /usr/include/glide -#ifdef DebianMaintainer -#define HasGlide3 YES -#endif -#define Glide3IncDir /usr/include/glide3 -#endif -#define XAppLoadDir EtcX11Directory/app-defaults -#define XFileSearchPathDefault Concat4(EtcX11Directory/%L/%T/%N%C,%S:EtcX11Directory/%l/%T/%N%C,%S:EtcX11Directory/%T/%N%C,%S:EtcX11Directory/%L/%T/%N%S:EtcX11Directory/%l/%T/%N%S:EtcX11Directory/%T/%N%S):Concat4($(LIBDIR)/%L/%T/%N%C,%S:$(LIBDIR)/%l/%T/%N%C,%S:$(LIBDIR)/%T/%N%C,%S:$(LIBDIR)/%L/%T/%N%S:$(LIBDIR)/%l/%T/%N%S:$(LIBDIR)/%T/%N%S) -#ifdef DebianMaintainer +/* # define JoystickSupport YES */ +# define InstallXinitConfig YES +# define InstallXdmConfig YES +# define InstallFSConfig YES +# define DebuggableLibraries YES +# define ForceNormalLib YES +# define BuildSpecsDocs YES +# define SpecsDocDirs CTEXT GL ICCCM X11 Xext Xv i18n xterm +# define XAppLoadDir EtcX11Directory/app-defaults +# define XFileSearchPathDefault Concat4(EtcX11Directory/%L/%T/%N%C,%S:EtcX11Directory/%l/%T/%N%C,%S:EtcX11Directory/%T/%N%C,%S:EtcX11Directory/%L/%T/%N%S:EtcX11Directory/%l/%T/%N%S:EtcX11Directory/%T/%N%S):Concat4($(LIBDIR)/%L/%T/%N%C,%S:$(LIBDIR)/%l/%T/%N%C,%S:$(LIBDIR)/%T/%N%C,%S:$(LIBDIR)/%L/%T/%N%S:$(LIBDIR)/%l/%T/%N%S:$(LIBDIR)/%T/%N%S) /* the relative symlink created by this rule causes problems for us */ -#if InstallAppDefFiles -#define InstallAppDefaultsLong(file,class) @@\ +# if InstallAppDefFiles +# define InstallAppDefaultsLong(file,class) @@\ InstallNamedTarget(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class) -#else -#define InstallAppDefaultsLong(file,class) @@\ +# else +# define InstallAppDefaultsLong(file,class) @@\ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class) -#endif /* InstallAppDefFiles */ -#endif -#ifdef DebianMaintainer -#define BuilderEMailAddr "submit@bugs.debian.org" -#endif -#define SharedLibXdmGreet YES -#define LinkGLToUsrInclude NO -#define LinkGLToUsrLib NO -#define SharedLibFont NO -#define SharedLibXft NO -#define SharedLibXrender NO -#define HasZlib YES -#define SharedLibGlu YES -#define NormalLibGlu YES -#define BuildRman NO -#define BuildHtmlManPages NO -#define FSUseSyslog YES -#ifndef HasKatmaiSupport -#define HasKatmaiSupport NO -#endif -#endif +# endif /* InstallAppDefFiles */ +# define SharedLibXdmGreet NO +# define LinkGLToUsrInclude NO +# define LinkGLToUsrLib NO +# define SharedLibFont NO +# define HasZlib YES +# define SharedLibGlu YES +# define NormalLibGlu YES +# define BuildRman NO +# define BuildHtmlManPages NO +# define FSUseSyslog YES + +/* + * + * +# define DebianMaintainer "xfree86@packages.debian.org" + * + * + */ + +# ifdef DebianMaintainer +# define BuilderEMailAddr "submit@bugs.debian.org" +# define XFree86Devel YES +# define BuildAllSpecsDocs YES +/* we build-depend on libfreetype6-dev (FreeType 2.x) */ +# define BuildFreetype2Library NO +# define HasXdmAuth YES +/* modern LaTeX chokes on ancient sync.tex document */ +/* # define HasLatex YES */ +# define BuilderEMailAddr "submit@bugs.debian.org" +/* right now glide 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 +# define HasGlide3 YES +# define Glide3IncDir /usr/include/glide3 +# endif /* i386Architecture */ +# endif /* DebianMaintiner */ +#endif /* LinuxDebian */ #if LinuxDistribution == LinuxRedHat #define FSUseSyslog YES @@ -266,6 +272,10 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class # define BuildXF86DRI YES # elif defined(PpcArchitecture) # define BuildXF86DRI NO +# elif defined(Mc68020Architecture) +# define BuildXF86DRI NO +# elif defined(Arm32Architecture) +# define BuildXF86DRI NO # else # define BuildXF86DRI NO # endif @@ -285,7 +295,7 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class kernel revisions. So, we'll only build the module for kernels that are known to be supported by the module. */ #ifndef BuildXF86DRM -# if defined(i386Architecture) || defined(ia64Architecture) +# if defined(i386Architecture) || defined(ia64Architecture) || defined(SparcArchitecture) || defined(AlphaArchitecture) # if OSMajorVersion == 2 /* Only tested for Linux 2.2.0 through 2.2.12 */ # if OSMinorVersion == 2 && OSTeenyVersion <= 12 @@ -416,6 +426,10 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class #define HasNCurses YES #endif +#ifndef HasGroff +#define HasGroff YES +#endif + #define AvoidNullMakeCommand YES #ifndef DebuggableLibraries #define DebuggableLibraries NO @@ -619,7 +633,7 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class # endif # define LinuxMachineDefines -D__alpha__ # define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET -# define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 +# define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 -DJENSEN_SUPPORT # ifdef UseCompaqMathLibrary # define MathLibrary -lcpml -lm # endif @@ -630,7 +644,7 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class # ifndef OptimizedCDebugFlags # define OptimizedCDebugFlags -O3 # endif -# define LinuxMachineDefines -D__arm__ -U__arm -Uarm +# define LinuxMachineDefines -D__arm__ -D__arm32__ -U__arm -Uarm # define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* Arm32Achitecture */ @@ -658,7 +672,7 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class #ifdef PpcArchitecture # define DefaultCCOptions -fsigned-char # ifndef OptimizedCDebugFlags -# define OptimizedCDebugFlags -O2 +# define OptimizedCDebugFlags DefaultGcc2PpcOpt # endif # define LinuxMachineDefines -D__powerpc__ # define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET @@ -758,7 +772,7 @@ InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class #define TtClientLibs $(TTLIB) $(XTOOLLIB) $(XLIB) #define TtClientDepLibs $(DEPTTLIB) $(DEPXTOOLLIB) $(DEPXLIB) -#ifdef S390Architecture +#ifdef s390Architecture # define HasXServer NO #endif diff --git a/xc/config/cf/lynx.cf b/xc/config/cf/lynx.cf index 7e5c4c55e..2ccfd95a1 100644 --- a/xc/config/cf/lynx.cf +++ b/xc/config/cf/lynx.cf @@ -3,7 +3,7 @@ XCOMM $Xorg: lynx.cf,v 1.3 2000/08/17 19:41:47 cpqbld Exp $ -XCOMM platform: $XFree86: xc/config/cf/lynx.cf,v 3.42 2001/01/23 23:31:49 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/lynx.cf,v 3.43 2001/04/19 19:54:43 dawes Exp $ #ifndef OSName @@ -281,6 +281,8 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe # define FileManDir $(MANSOURCEPATH)5 #endif +#define HasGroff YES + /* groff 1.09 compiles right out of the box with LynxOS 2.3, * so if you want to have manual pages you should install groff 1.09 * before you run 'make install.man' diff --git a/xc/config/cf/mach.cf b/xc/config/cf/mach.cf index cbc7f1d2b..4489ee678 100644 --- a/xc/config/cf/mach.cf +++ b/xc/config/cf/mach.cf @@ -2,7 +2,7 @@ XCOMM $Xorg: mach.cf,v 1.3 2000/08/17 19:41:47 cpqbld Exp $ -XCOMM platform: $XFree86: xc/config/cf/mach.cf,v 3.12 2001/01/17 16:22:32 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/mach.cf,v 3.13 2001/04/19 19:54:43 dawes Exp $ #define OSName Mach 2.5/3.0 #define OSVendor /**/ @@ -61,7 +61,7 @@ XCOMM operating system: OSName # define PreIncDir /usr/include #endif -#define TroffCmd groff -Tps +#define HasGroff YES #ifndef ExtraFilesToClean # define ExtraFilesToClean *.core diff --git a/xc/config/cf/os2.cf b/xc/config/cf/os2.cf index e123328db..8f65b6e16 100644 --- a/xc/config/cf/os2.cf +++ b/xc/config/cf/os2.cf @@ -2,7 +2,7 @@ XCOMM $Xorg: os2.cf,v 1.3 2000/08/17 19:41:48 cpqbld Exp $ -XCOMM platform: $XFree86: xc/config/cf/os2.cf,v 3.33 2001/01/17 16:22:32 dawes Exp $ +XCOMM platform: $XFree86: xc/config/cf/os2.cf,v 3.34 2001/04/19 19:54:43 dawes Exp $ #define OSName OS/2 #define OSVendor IBM @@ -62,7 +62,7 @@ XCOMM platform: $XFree86: xc/config/cf/os2.cf,v 3.33 2001/01/17 16:22:32 dawes #define NeqnCmd eqn #define NroffCmd groff -Tascii #define EqnCmd eqn -Tascii -#define TroffCmd groff -Tps +#define HasGroff YES NEQN = NeqnCmd NROFF = NroffCmd diff --git a/xc/config/cf/xfree86.cf b/xc/config/cf/xfree86.cf index 57ac75dc6..f19945e5e 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.354 2001/04/05 21:29:09 dawes Exp $ +XCOMM $XFree86: xc/config/cf/xfree86.cf,v 3.358 2001/04/20 16:00:46 alanh Exp $ /* * This configuration file contains all of the configuration * information for the XFree86 based X Servers. @@ -104,7 +104,7 @@ XCOMM $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ #define XLogFile XFree86 #endif - /* +/* * BuildXFree86ConfigTools: * * Turning this on allows the XFree86 config tools to build when @@ -322,7 +322,11 @@ XCOMM $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ /* Sparc drivers */ -#if defined(SparcArchitecture) && !defined(LynxOSArchitecture) && !defined(NetBSDArchitecture) && !defined(OpenBSDArchitecture) && !defined(SunArchitecture) +#if defined(SparcArchitecture) && \ + !defined(LynxOSArchitecture) && \ + !defined(NetBSDArchitecture) && \ + !defined(OpenBSDArchitecture) && \ + !defined(SunArchitecture) # ifndef XF86Server # define XF86Server YES # endif @@ -389,8 +393,8 @@ XCOMM $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ sunbw2 ati glint fbdev \ XF86OSCardDrivers XF86ExtraCardDrivers # endif -# ifndef DRIDrivers -# define DRIDrivers ffb +# ifndef DriDrivers +# define DriDrivers ffb # endif #endif @@ -638,6 +642,14 @@ XCOMM $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ DevelDrivers vga \ XF86OSCardDrivers XF86ExtraCardDrivers # endif +# if HasGlide3 +# define TdfxDriDriver tdfx +# else +# define TdfxDriDriver /**/ +# endif +# ifndef DriDrivers +# define DriDrivers gamma TdfxDriDriver mga r128 radeon +# endif #endif @@ -769,11 +781,25 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8 # define GlxBuiltInSIS NO # endif -# if GlxBuiltInTdfx || GlxBuiltInMga || GlxBuiltInI810 || GlxBuiltInR128 || GlxBuiltInRadeon || GlxBuildInFfb || GlxBuiltInSIS +# if GlxBuiltInTdfx || \ + GlxBuiltInMga || \ + GlxBuiltInI810 || \ + GlxBuiltInR128 || \ + GlxBuiltInRadeon || \ + GlxBuildInFfb || \ + GlxBuiltInSIS # define GlxDriverUsesMesa YES # endif -# if GlxBuiltInGamma || GlxBuiltInTdfx || GlxBuiltInMga || GlxBuiltInI810 || GlxBuiltInR128 || GlxBuiltInRadeon || GlxBuiltInFfb || GlxBuiltInSIS || GlxBuiltInMesa +# if GlxBuiltInGamma || \ + GlxBuiltInTdfx || \ + GlxBuiltInMga || \ + GlxBuiltInI810 || \ + GlxBuiltInR128 || \ + GlxBuiltInRadeon || \ + GlxBuiltInFfb || \ + GlxBuiltInSIS || \ + GlxBuiltInMesa # define GlxUseBuiltInDRIDriver YES # define DRIDynLoadDefines /**/ # else @@ -992,6 +1018,13 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8 #endif /* + * Build SuperProbe + */ +#ifndef BuildSuperProbe +# define BuildSuperProbe NO +#endif + +/* * Build XF86Setup -- needs Tk and Tcl */ /* There are problems building XF86Setup, so turn it off for now */ @@ -1000,7 +1033,8 @@ IPLAN2P8_DEFS = -DUSE_IPLAN2P8 #endif #ifndef BuildXF86Setup -# if HasTk && HasTcl && BuildXF86VidModeLibrary && BuildXF86MiscLibrary && BuildXKBlib +# if HasTk && HasTcl && \ + BuildXF86VidModeLibrary && BuildXF86MiscLibrary && BuildXKBlib # define BuildXF86Setup YES # else # define BuildXF86Setup NO @@ -1373,6 +1407,12 @@ XFREE86JAPANESEDOCDIR = $(DOCDIR)/Japanese # endif #endif +#if HasGcc2 && defined(PpcArchitecture) +# ifndef DefaultGcc2PpcOpt +# define DefaultGcc2PpcOpt -O2 +# endif +#endif + #ifndef DefaultGcc2DebugOpt # define DefaultGcc2DebugOpt -g #endif diff --git a/xc/config/cf/xttMod.tmpl b/xc/config/cf/xttMod.tmpl index 40f65cbd6..dc83240ca 100644 --- a/xc/config/cf/xttMod.tmpl +++ b/xc/config/cf/xttMod.tmpl @@ -1,6 +1,6 @@ /* -*- Makefile -*- */ XCOMM Code converter template of X-TT -XCOMM $XFree86: xc/config/cf/xttMod.tmpl,v 1.5 2000/08/24 22:20:06 tsi Exp $ */ +XCOMM $XFree86: xc/config/cf/xttMod.tmpl,v 1.6 2001/04/23 21:41:43 dawes Exp $ */ #ifdef IHaveModules /* New designed XFree86 module */ @@ -33,7 +33,7 @@ InstallDriverSDKLibraryModule($(MODULENAME),$(DRIVERSDKMODULEDIR),codeconv) # else /* dlopen based code converter */ -#if DoLoadableServer +#if DoLoadableServer && BuildServer #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" SUBDIRS = module @@ -75,7 +75,7 @@ SharedDepModuleTarget($(CCONV_MODULE_FILE),$(OBJS),$(OBJS)) #endif /* 0 */ -#if DoLoadableServer +#if DoLoadableServer && BuildServer MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif diff --git a/xc/config/imake/imakemdep.h b/xc/config/imake/imakemdep.h index 05c5b89f8..6d47f2f66 100644 --- a/xc/config/imake/imakemdep.h +++ b/xc/config/imake/imakemdep.h @@ -20,7 +20,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/config/imake/imakemdep.h,v 3.48 2001/03/27 00:21:17 torrey Exp $ */ +/* $XFree86: xc/config/imake/imakemdep.h,v 3.50 2001/04/25 16:44:54 tsi Exp $ */ /* @@ -653,6 +653,12 @@ char *cpp_argv[ARGUMENTS] = { #if defined(__APPLE__) "-D__APPLE__", "-D__DARWIN__", +# ifdef __ppc__ + "-D__ppc__", +# endif +# ifdef __i386__ + "-D__i386__", +# endif #endif }; @@ -906,7 +912,14 @@ struct symtab predefs[] = { {"mc68020", "1"}, #endif #ifdef __GNUC__ +# if __GNUC__ == 1 {"__GNUC__", "1"}, +# else + {"__GNUC__", "2"}, +# endif +#endif +#ifdef __STRICT_ANSI__ + {"__STRICT_ANSI__", "1"}, #endif #if __STDC__ {"__STDC__", "1"}, diff --git a/xc/config/makedepend/cppsetup.c b/xc/config/makedepend/cppsetup.c index 492033c8e..1190f39c8 100644 --- a/xc/config/makedepend/cppsetup.c +++ b/xc/config/makedepend/cppsetup.c @@ -20,7 +20,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/config/makedepend/cppsetup.c,v 3.6 2001/01/17 16:38:57 dawes Exp $ */ +/* $XFree86: xc/config/makedepend/cppsetup.c,v 3.8 2001/04/27 03:03:51 tsi Exp $ */ #include "def.h" @@ -181,6 +181,7 @@ my_eval_defined (IfParser *ip, const char *var, int len) static long my_eval_variable (IfParser *ip, const char *var, int len) { + long val; struct symtab **s; s = lookup_variable (ip, var, len); @@ -193,7 +194,9 @@ my_eval_variable (IfParser *ip, const char *var, int len) s = lookup_variable (ip, var, strlen(var)); } while (s); - return strtol(var, NULL, 0); + var = ParseIfExpression(ip, var, &val); + if (var && *var) debug(3, ("extraneous: '%s'\n", var)); + return val; } int diff --git a/xc/config/makedepend/main.c b/xc/config/makedepend/main.c index 4697bfd13..b10465fec 100644 --- a/xc/config/makedepend/main.c +++ b/xc/config/makedepend/main.c @@ -20,7 +20,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/config/makedepend/main.c,v 3.18 2001/01/17 16:38:59 dawes Exp $ */ +/* $XFree86: xc/config/makedepend/main.c,v 3.19 2001/04/25 16:44:55 tsi Exp $ */ #include "def.h" #ifdef hpux @@ -570,10 +570,7 @@ char *getnextline(struct filepointer *filep) *p++ = ' ', *p++ = ' '; while (*p && *p != '\n') *p++ = ' '; - if (*p == '\n') { - lineno++; - *p++ = ' '; - } + if (*p == '\n') --p; continue; } else if (*p == '\\') { @@ -593,6 +590,7 @@ char *getnextline(struct filepointer *filep) for (cp = bol+1; *cp && (*cp == ' ' || *cp == '\t'); cp++); if (*cp) goto done; + --p; } bol = p+1; } diff --git a/xc/config/util/Imakefile b/xc/config/util/Imakefile index 880baf9dd..3f5219737 100644 --- a/xc/config/util/Imakefile +++ b/xc/config/util/Imakefile @@ -2,10 +2,10 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:41:52 cpqbld Exp $ -XCOMM $XFree86: xc/config/util/Imakefile,v 3.34 2001/03/21 20:25:00 dawes Exp $ +XCOMM $XFree86: xc/config/util/Imakefile,v 3.36 2001/04/26 21:09:39 dawes Exp $ #if UseCCMakeDepend -MDEP_PROG = makedepend +CCMDEP_PROG = ccmakedep #endif #ifdef ExportListGenSource @@ -29,7 +29,7 @@ RMAN_PROG = ProgramTargetName(rman) QNXCopyInstaller($(PROJECTROOT)/bin/install.qnx,./install.sh) #endif -PROGRAMS = xmkmf $(MDEP_PROG) $(GCCMDEP_PROG) mergelib $(LNDIR_PROG) \ +PROGRAMS = xmkmf $(CCMDEP_PROG) $(GCCMDEP_PROG) mergelib $(LNDIR_PROG) \ $(RMAN_PROG) ProgramTargetName(revpath) \ ProgramTargetName(makestrs) $(EXPORTLISTGEN) $(CMKDIRHIER) DEPLIBS = @@ -67,7 +67,7 @@ InstallNamedProg(exportlistgen,exportlistgen,$(BINDIR)) #endif CppScriptTarget(xmkmf,xmkmf.cpp,-DCONFIGDIRSPEC='"'"-I$(CONFIGDIR)"'"',$(ICONFIGFILES)) -CppScriptTarget(makedepend,mdepend.cpp,-DPREPROC='"'"$(PREPROCESSCMD_MKDEPEND)"'"',$(ICONFIGFILES)) +CppScriptTarget(ccmakedep,mdepend.cpp,-DPREPROC='"'"$(PREPROCESSCMD_MKDEPEND)"'"',$(ICONFIGFILES)) CppScriptTarget(mergelib,mergelib.cpp,"-DARCMD=$(AR)" "-DRANLIB=$(RANLIB)",$(ICONFIGFILES)) #ifndef OS2Architecture CppScriptTarget(gccmakedep,gccmdep.cpp,-DCCCMD='"'"$(GCCCMD)"'"' -DRMCMD='"'"$(RM)"'"' -DLNCMD='"'"$(LN)"'"' -DMVCMD='"'"$(MV)"'"',$(ICONFIGFILES)) @@ -138,10 +138,8 @@ InstallNamedProg(mkhtmlindex.sh,mkhtmlindex,$(BINDIR)) #endif #endif InstallManPage(mkdirhier,$(MANDIR)) -#if UseCCMakeDepend -InstallNamedProg(makedepend,makedepend,$(BINDIR)) -InstallDriverSDKNamedProg(makedepend,makedepend,$(DRIVERSDKDIR)/config/util) -#endif +InstallNamedProg(ccmakedep,ccmakedep,$(BINDIR)) +InstallDriverSDKNamedProg(ccmakedep,ccmakedep,$(DRIVERSDKDIR)/config/util) #if SystemV || SystemV4 InstallNamedProg(bsdinst.sh,bsdinst,$(BINDIR)) InstallDriverSDKNamedProg(bsdinst.sh,bsdinst.sh,$(DRIVERSDKDIR)/config/util) diff --git a/xc/config/util/mdepend.cpp b/xc/config/util/mdepend.cpp index 364855551..5aef89521 100644 --- a/xc/config/util/mdepend.cpp +++ b/xc/config/util/mdepend.cpp @@ -22,7 +22,7 @@ XCOMM work on both USG and BSD systems. However, when System V.4 comes out, XCOMM USG users will probably have to change "silent" to "-s" instead of XCOMM "-" (at least, that is what the documentation implies). XCOMM -XCOMM $XFree86: xc/config/util/mdepend.cpp,v 3.7 2001/03/15 18:39:00 tsi Exp $ +XCOMM $XFree86: xc/config/util/mdepend.cpp,v 3.9 2001/04/26 20:55:10 dawes Exp $ XCOMM CC=PREPROC diff --git a/xc/extras/Mesa/include/GL/gl.h b/xc/extras/Mesa/include/GL/gl.h index 6895f4201..89e371bd9 100644 --- a/xc/extras/Mesa/include/GL/gl.h +++ b/xc/extras/Mesa/include/GL/gl.h @@ -22,7 +22,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/extras/Mesa/include/GL/gl.h,v 1.8 2001/01/08 01:07:12 martin Exp $ */ +/* $XFree86: xc/extras/Mesa/include/GL/gl.h,v 1.9 2001/04/09 23:08:58 dawes Exp $ */ #ifndef __gl_h_ @@ -63,7 +63,7 @@ # define GLAPIENTRY #endif /* WIN32 / CYGWIN bracket */ -#if defined(_WIN32) && !defined(_WINGDI_) && !defined(__CYGWIN__) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) +#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(__CYGWIN__) #include <gl/mesa_wgl.h> #endif diff --git a/xc/extras/Mesa/src/X/xmesa2.c b/xc/extras/Mesa/src/X/xmesa2.c index 3b4ca355e..96d6d8761 100644 --- a/xc/extras/Mesa/src/X/xmesa2.c +++ b/xc/extras/Mesa/src/X/xmesa2.c @@ -944,16 +944,16 @@ clear_32bit_ximage( GLcontext *ctx, GLboolean all, GLint x, GLint y, GLint width, GLint height ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - if (all) { - register GLint n = xmesa->xm_buffer->width * xmesa->xm_buffer->height; - register GLuint *ptr4 = (GLuint *) xmesa->xm_buffer->backimage->data; - register GLuint pixel = (GLuint) xmesa->clearpixel; - if (xmesa->swapbytes) { - pixel = ((pixel >> 24) & 0x000000ff) + register GLuint pixel = (GLuint) xmesa->clearpixel; + if (xmesa->swapbytes) { + pixel = ((pixel >> 24) & 0x000000ff) | ((pixel >> 8) & 0x0000ff00) | ((pixel << 8) & 0x00ff0000) | ((pixel << 24) & 0xff000000); - } + } + if (all) { + register GLint n = xmesa->xm_buffer->width * xmesa->xm_buffer->height; + register GLuint *ptr4 = (GLuint *) xmesa->xm_buffer->backimage->data; if (pixel==0) { MEMSET( ptr4, pixel, 4*n ); } @@ -966,7 +966,6 @@ clear_32bit_ximage( GLcontext *ctx, GLboolean all, } else { register int i, j; - register GLuint pixel = (GLuint) xmesa->clearpixel; for (j=0;j<height;j++) { register GLuint *ptr4 = PIXELADDR4( xmesa->xm_buffer, x, y+j ); for (i=0;i<width;i++) { diff --git a/xc/extras/Mesa/src/aatritemp.h b/xc/extras/Mesa/src/aatritemp.h index e0d623eb0..38c2fa24a 100644 --- a/xc/extras/Mesa/src/aatritemp.h +++ b/xc/extras/Mesa/src/aatritemp.h @@ -354,6 +354,10 @@ startX--; } + if (startX > ctx->DrawBuffer->Xmax) { + startX = ctx->DrawBuffer->Xmax; + } + /* enter interior of triangle */ ix = startX; count = 0; diff --git a/xc/extras/Mesa/src/context.c b/xc/extras/Mesa/src/context.c index 43219cd28..326fc58aa 100644 --- a/xc/extras/Mesa/src/context.c +++ b/xc/extras/Mesa/src/context.c @@ -1890,7 +1890,11 @@ _mesa_get_dispatch(GLcontext *ctx) void gl_problem( const GLcontext *ctx, const char *s ) { fprintf( stderr, "Mesa implementation error: %s\n", s ); - fprintf( stderr, "Report to Mesa bug database at www.mesa3d.org\n" ); +#ifdef XF86DRI + fprintf( stderr, "Please report to the DRI bug database at dri.sourceforge.net\n"); +#else + fprintf( stderr, "Please report to the Mesa bug database at www.mesa3d.org\n" ); +#endif (void) ctx; } diff --git a/xc/extras/Mesa/src/fog_tmp.h b/xc/extras/Mesa/src/fog_tmp.h index b3400d4e6..830173129 100644 --- a/xc/extras/Mesa/src/fog_tmp.h +++ b/xc/extras/Mesa/src/fog_tmp.h @@ -251,6 +251,7 @@ static void TAG(fog_rgba_vertices)( struct vertex_buffer *VB, CLAMPED_FLOAT_COLOR_TO_UBYTE_COLOR(out[i][2], t); } + out[i][3] = in[3]; } } break; @@ -269,6 +270,7 @@ static void TAG(fog_rgba_vertices)( struct vertex_buffer *VB, t = f * UBYTE_COLOR_TO_FLOAT_COLOR(in[2]) + (1.0F-f)*bFog; CLAMPED_FLOAT_COLOR_TO_UBYTE_COLOR(out[i][2], t); } + out[i][3] = in[3]; } break; case GL_EXP2: @@ -287,6 +289,7 @@ static void TAG(fog_rgba_vertices)( struct vertex_buffer *VB, t = f * UBYTE_COLOR_TO_FLOAT_COLOR(in[2]) + (1.0F-f)*bFog; CLAMPED_FLOAT_COLOR_TO_UBYTE_COLOR(out[i][2], t); } + out[i][3] = in[3]; } break; default: diff --git a/xc/extras/Mesa/src/glheader.h b/xc/extras/Mesa/src/glheader.h index 3877ed0ac..9a05e7ebc 100644 --- a/xc/extras/Mesa/src/glheader.h +++ b/xc/extras/Mesa/src/glheader.h @@ -22,7 +22,6 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/extras/Mesa/src/glheader.h,v 1.13 2001/01/17 12:50:06 alanh Exp $ */ #ifndef GLHEADER_H diff --git a/xc/extras/Mesa/src/image.c b/xc/extras/Mesa/src/image.c index 3c1f10aad..87ba3699c 100644 --- a/xc/extras/Mesa/src/image.c +++ b/xc/extras/Mesa/src/image.c @@ -1542,48 +1542,6 @@ _mesa_pack_rgba_span( GLcontext *ctx, rgba[i][ACOMP] = srcRgba[i][ACOMP] * ascale; } - /* - * Apply scale, bias and lookup-tables if enabled. - */ - if (applyTransferOps) { - /* scale & bias */ - if (ctx->Pixel.ScaleOrBiasRGBA) { - _mesa_scale_and_bias_rgba( ctx, n, rgba ); - } - /* color map lookup */ - if (ctx->Pixel.MapColorFlag) { - _mesa_map_rgba( ctx, n, rgba ); - } - /* GL_COLOR_TABLE lookup */ - if (ctx->Pixel.ColorTableEnabled) { - _mesa_lookup_rgba(&ctx->ColorTable, n, rgba); - } - /* XXX convolution here */ - /* GL_POST_CONVOLUTION_COLOR_TABLE lookup */ - if (ctx->Pixel.PostConvolutionColorTableEnabled) { - _mesa_lookup_rgba(&ctx->PostConvolutionColorTable, n, rgba); - } - /* color matrix transform */ - if (ctx->ColorMatrix.type != MATRIX_IDENTITY || - ctx->Pixel.ScaleOrBiasRGBApcm) { - _mesa_transform_rgba(ctx, n, rgba); - } - /* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ - if (ctx->Pixel.PostColorMatrixColorTableEnabled) { - _mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba); - } - /* update histogram count */ - if (ctx->Pixel.HistogramEnabled) { - _mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); - } - /* XXX min/max here */ - if (ctx->Pixel.MinMaxEnabled) { - _mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); - if (ctx->MinMax.Sink) - return; - } - } - _mesa_pack_float_rgba_span(ctx, n, (const GLfloat (*)[4]) rgba, format, type, destination, packing, applyTransferOps); @@ -1863,8 +1821,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], stride = 2; break; case GL_INTENSITY: - redIndex = 0; - greenIndex = blueIndex = alphaIndex = -1; + redIndex = greenIndex = blueIndex = alphaIndex = 0; stride = 1; break; case GL_RGB: diff --git a/xc/extras/Mesa/src/mmath.h b/xc/extras/Mesa/src/mmath.h index dae66eac6..b737c8036 100644 --- a/xc/extras/Mesa/src/mmath.h +++ b/xc/extras/Mesa/src/mmath.h @@ -22,7 +22,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/extras/Mesa/src/mmath.h,v 1.7 2000/09/24 13:50:14 alanh Exp $ */ + /* * Faster arithmetic functions. If the FAST_MATH preprocessor symbol is diff --git a/xc/extras/Mesa/src/texformat.c b/xc/extras/Mesa/src/texformat.c index df2ad273d..f85725843 100644 --- a/xc/extras/Mesa/src/texformat.c +++ b/xc/extras/Mesa/src/texformat.c @@ -1,4 +1,3 @@ -/* $Id: texformat.c,v 1.1.1.1 2001/04/09 16:27:25 dawes Exp $ */ /* * Mesa 3-D graphics library diff --git a/xc/extras/Mesa/src/texformat.h b/xc/extras/Mesa/src/texformat.h index 518f7258b..8f5e7de75 100644 --- a/xc/extras/Mesa/src/texformat.h +++ b/xc/extras/Mesa/src/texformat.h @@ -1,4 +1,3 @@ -/* $Id: texformat.h,v 1.1.1.1 2001/04/09 16:27:26 dawes Exp $ */ /* * Mesa 3-D graphics library diff --git a/xc/extras/Mesa/src/texobj.c b/xc/extras/Mesa/src/texobj.c index 3b8aaecbe..92da25b30 100644 --- a/xc/extras/Mesa/src/texobj.c +++ b/xc/extras/Mesa/src/texobj.c @@ -492,6 +492,7 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *texName) ctx->Shared->DefaultD[d]->RefCount++; t->RefCount--; ASSERT( t->RefCount >= 0 ); + ctx->NewState |= NEW_TEXTURING; } } } diff --git a/xc/extras/Mesa/src/texstate.c b/xc/extras/Mesa/src/texstate.c index bb82b1861..d74feb578 100644 --- a/xc/extras/Mesa/src/texstate.c +++ b/xc/extras/Mesa/src/texstate.c @@ -129,7 +129,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) return; /* no change */ texUnit->CombineModeRGB = mode; ctx->NewState |= NEW_TEXTURE_ENV; - break; + break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); return; diff --git a/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/curve.cc b/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/curve.cc index bdc0e278e..ceaaf9ff9 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/curve.cc +++ b/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/curve.cc @@ -1,3 +1,4 @@ +/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/curve.cc,v 1.3 2001/04/27 12:58:28 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -35,8 +36,8 @@ /* * curve.c++ * - * $Date: 2001/03/19 17:45:28 $ $Revision: 1.1.1.1 $ - * $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/Attic/curve.cc,v 1.1.1.1 2001/03/19 17:45:28 dawes Exp $ + * $Date: 2001/05/01 17:07:32 $ $Revision: 1.1.1.2 $ + * $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/Attic/curve.cc,v 1.1.1.2 2001/05/01 17:07:32 dawes Exp $ */ #include "glimports.h" @@ -48,6 +49,7 @@ #include "types.h" #include "quilt.h" #include "nurbsconsts.h" +#include "gluint.h" /*-------------------------------------------------------------------------- * Curve::Curve - copy curve from quilt and transform control points @@ -170,7 +172,7 @@ Curve::getstepsize( void ) REAL t = mapdesc->getProperty( N_PIXEL_TOLERANCE ); if( mapdesc->isParametricDistanceSampling() ) { REAL d = mapdesc->calcPartialVelocity( &tmp[0][0], tstride, order, 2, range[2] ); - stepsize = (d > 0.0) ? ::sqrtf( 8.0 * t / d ) : range[2]; + stepsize = (d > 0.0) ? ::SQRT( 8.0 * t / d ) : range[2]; minstepsize = ( mapdesc->maxrate > 0.0 ) ? (range[2] / mapdesc->maxrate) : 0.0; } else if( mapdesc->isPathLengthSampling() ) { // t is upper bound on path (arc) length diff --git a/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/mapdescv.cc b/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/mapdescv.cc index c1863fe62..8b04ac13c 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/mapdescv.cc +++ b/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/mapdescv.cc @@ -1,3 +1,4 @@ +/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/mapdescv.cc,v 1.3 2001/04/27 12:58:28 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -35,8 +36,8 @@ /* * mapdescv.c++ * - * $Date: 2001/03/19 17:45:28 $ $Revision: 1.1.1.1 $ - * $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/Attic/mapdescv.cc,v 1.1.1.1 2001/03/19 17:45:28 dawes Exp $ + * $Date: 2001/05/01 17:07:32 $ $Revision: 1.1.1.2 $ + * $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/Attic/mapdescv.cc,v 1.1.1.2 2001/05/01 17:07:32 dawes Exp $ */ #include "glimports.h" @@ -46,6 +47,7 @@ #include "mymath.h" #include "nurbsconsts.h" #include "mapdesc.h" +#include "gluint.h" /*-------------------------------------------------------------------------- * calcPartialVelocity - calculate maximum magnitude of a given partial @@ -93,7 +95,7 @@ Mapdesc::calcPartialVelocity ( REAL max = 0.0; for( j=0; j != ncols-partial; j++ ) if( mag[j] > max ) max = mag[j]; - max = fac * ::sqrtf( (float) max ); + max = fac * ::SQRT( (float) max ); return max; } @@ -217,8 +219,8 @@ Mapdesc::calcPartialVelocity ( j = ncols-tpartial-1; if( mag[i][j] > dist[1] ) dist[1] = mag[i][j]; } - dist[0] = fac * ::sqrtf( dist[0] ); - dist[1] = fac * ::sqrtf( dist[1] ); + dist[0] = fac * ::SQRT( dist[0] ); + dist[1] = fac * ::SQRT( dist[1] ); } else if( side == 1 ) { // compute max magnitude of first and last row dist[0] = 0.0; @@ -230,11 +232,11 @@ Mapdesc::calcPartialVelocity ( i = nrows-spartial-1; if( mag[i][j] > dist[1] ) dist[1] = mag[i][j]; } - dist[0] = fac * ::sqrtf( dist[0] ); - dist[1] = fac * ::sqrtf( dist[1] ); + dist[0] = fac * ::SQRT( dist[0] ); + dist[1] = fac * ::SQRT( dist[1] ); } - max = fac * ::sqrtf( (float) max ); + max = fac * ::SQRT( (float) max ); return max; } diff --git a/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/patch.cc b/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/patch.cc index 3857775a6..b5ff8ad8a 100755 --- a/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/patch.cc +++ b/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/patch.cc @@ -1,3 +1,4 @@ +/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/patch.cc,v 1.3 2001/04/27 12:58:28 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -35,8 +36,8 @@ /* * patch.c++ * - * $Date: 2001/03/19 17:45:28 $ $Revision: 1.1.1.1 $ - * $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/Attic/patch.cc,v 1.1.1.1 2001/03/19 17:45:28 dawes Exp $ + * $Date: 2001/05/01 17:07:32 $ $Revision: 1.1.1.2 $ + * $Header: /home/ajax/dri-backup/xc/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/internals/Attic/patch.cc,v 1.1.1.2 2001/05/01 17:07:32 dawes Exp $ */ #include <stdio.h> @@ -50,6 +51,7 @@ #include "quilt.h" #include "nurbsconsts.h" #include "simplemath.h" //for abs function in ::singleStep(); +#include "gluint.h" /*-------------------------------------------------------------------------- @@ -321,43 +323,43 @@ Patch::getstepsize( void ) if( ss != 0.0 && tt != 0.0 ) { /* printf( "ssv[0] %g ssv[1] %g ttv[0] %g ttv[1] %g\n", ssv[0], ssv[1], ttv[0], ttv[1] ); */ - REAL ttq = ::sqrtf( (float) ss ); - REAL ssq = ::sqrtf( (float) tt ); - REAL ds = ::sqrtf( 4 * t2 * ttq / ( ss * ttq + st * ssq ) ); - REAL dt = ::sqrtf( 4 * t2 * ssq / ( tt * ssq + st * ttq ) ); + REAL ttq = ::SQRT( (float) ss ); + REAL ssq = ::SQRT( (float) tt ); + REAL ds = ::SQRT( 4 * t2 * ttq / ( ss * ttq + st * ssq ) ); + REAL dt = ::SQRT( 4 * t2 * ssq / ( tt * ssq + st * ttq ) ); pspec[0].stepsize = ( ds < pspec[0].range[2] ) ? ds : pspec[0].range[2]; REAL scutoff = 2.0 * t2 / ( pspec[0].range[2] * pspec[0].range[2]); - pspec[0].sidestep[0] = (ssv[0] > scutoff) ? ::sqrtf( 2.0 * t2 / ssv[0] ) : pspec[0].range[2]; - pspec[0].sidestep[1] = (ssv[1] > scutoff) ? ::sqrtf( 2.0 * t2 / ssv[1] ) : pspec[0].range[2]; + pspec[0].sidestep[0] = (ssv[0] > scutoff) ? ::SQRT( 2.0 * t2 / ssv[0] ) : pspec[0].range[2]; + pspec[0].sidestep[1] = (ssv[1] > scutoff) ? ::SQRT( 2.0 * t2 / ssv[1] ) : pspec[0].range[2]; pspec[1].stepsize = ( dt < pspec[1].range[2] ) ? dt : pspec[1].range[2]; REAL tcutoff = 2.0 * t2 / ( pspec[1].range[2] * pspec[1].range[2]); - pspec[1].sidestep[0] = (ttv[0] > tcutoff) ? ::sqrtf( 2.0 * t2 / ttv[0] ) : pspec[1].range[2]; - pspec[1].sidestep[1] = (ttv[1] > tcutoff) ? ::sqrtf( 2.0 * t2 / ttv[1] ) : pspec[1].range[2]; + pspec[1].sidestep[0] = (ttv[0] > tcutoff) ? ::SQRT( 2.0 * t2 / ttv[0] ) : pspec[1].range[2]; + pspec[1].sidestep[1] = (ttv[1] > tcutoff) ? ::SQRT( 2.0 * t2 / ttv[1] ) : pspec[1].range[2]; } else if( ss != 0.0 ) { REAL x = pspec[1].range[2] * st; - REAL ds = ( ::sqrtf( x * x + 8.0 * t2 * ss ) - x ) / ss; + REAL ds = ( ::SQRT( x * x + 8.0 * t2 * ss ) - x ) / ss; pspec[0].stepsize = ( ds < pspec[0].range[2] ) ? ds : pspec[0].range[2]; REAL scutoff = 2.0 * t2 / ( pspec[0].range[2] * pspec[0].range[2]); - pspec[0].sidestep[0] = (ssv[0] > scutoff) ? ::sqrtf( 2.0 * t2 / ssv[0] ) : pspec[0].range[2]; - pspec[0].sidestep[1] = (ssv[1] > scutoff) ? ::sqrtf( 2.0 * t2 / ssv[1] ) : pspec[0].range[2]; + pspec[0].sidestep[0] = (ssv[0] > scutoff) ? ::SQRT( 2.0 * t2 / ssv[0] ) : pspec[0].range[2]; + pspec[0].sidestep[1] = (ssv[1] > scutoff) ? ::SQRT( 2.0 * t2 / ssv[1] ) : pspec[0].range[2]; pspec[1].singleStep(); } else if( tt != 0.0 ) { REAL x = pspec[0].range[2] * st; - REAL dt = ( ::sqrtf( x * x + 8.0 * t2 * tt ) - x ) / tt; + REAL dt = ( ::SQRT( x * x + 8.0 * t2 * tt ) - x ) / tt; pspec[0].singleStep(); REAL tcutoff = 2.0 * t2 / ( pspec[1].range[2] * pspec[1].range[2]); pspec[1].stepsize = ( dt < pspec[1].range[2] ) ? dt : pspec[1].range[2]; - pspec[1].sidestep[0] = (ttv[0] > tcutoff) ? ::sqrtf( 2.0 * t2 / ttv[0] ) : pspec[1].range[2]; - pspec[1].sidestep[1] = (ttv[1] > tcutoff) ? ::sqrtf( 2.0 * t2 / ttv[1] ) : pspec[1].range[2]; + pspec[1].sidestep[0] = (ttv[0] > tcutoff) ? ::SQRT( 2.0 * t2 / ttv[0] ) : pspec[1].range[2]; + pspec[1].sidestep[1] = (ttv[1] > tcutoff) ? ::SQRT( 2.0 * t2 / ttv[1] ) : pspec[1].range[2]; } else { if( 4.0 * t2 > st * pspec[0].range[2] * pspec[1].range[2] ) { pspec[0].singleStep(); pspec[1].singleStep(); } else { REAL area = 4.0 * t2 / st; - REAL ds = ::sqrtf( area * pspec[0].range[2] / pspec[1].range[2] ); - REAL dt = ::sqrtf( area * pspec[1].range[2] / pspec[0].range[2] ); + REAL ds = ::SQRT( area * pspec[0].range[2] / pspec[1].range[2] ); + REAL dt = ::SQRT( area * pspec[1].range[2] / pspec[0].range[2] ); pspec[0].stepsize = ( ds < pspec[0].range[2] ) ? ds : pspec[0].range[2]; pspec[0].sidestep[0] = pspec[0].range[2]; pspec[0].sidestep[1] = pspec[0].range[2]; @@ -417,8 +419,8 @@ Patch::getstepsize( void ) if( ms != 0.0 && mt != 0.0 ) { REAL d = 1.0 / (ms * mt); t *= M_SQRT2; - REAL ds = t * ::sqrtf( d * pspec[0].range[2] / pspec[1].range[2] ); - REAL dt = t * ::sqrtf( d * pspec[1].range[2] / pspec[0].range[2] ); + REAL ds = t * ::SQRT( d * pspec[0].range[2] / pspec[1].range[2] ); + REAL dt = t * ::SQRT( d * pspec[1].range[2] / pspec[0].range[2] ); pspec[0].stepsize = ( ds < pspec[0].range[2] ) ? ds : pspec[0].range[2]; pspec[0].sidestep[0] = ( msv[0] * pspec[0].range[2] > t ) ? (t / msv[0]) : pspec[0].range[2]; pspec[0].sidestep[1] = ( msv[1] * pspec[0].range[2] > t ) ? (t / msv[1]) : pspec[0].range[2]; diff --git a/xc/include/GL/glxproto.h b/xc/include/GL/glxproto.h index e63d98089..4c3397139 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.3 2001/03/21 15:51:38 dawes Exp $ */ +/* $XFree86: xc/include/GL/glxproto.h,v 1.4 2001/04/10 16:07:49 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 @@ -50,7 +50,7 @@ #define GLXBadContextTag 4 #define GLXBadCurrentWindow 5 #define GLXBadRenderRequest 6 -#define GLXBadLargeRequest 7 +#define GLXBadLargeRequest 7 #define GLXUnsupportedPrivateRequest 8 #define GLXBadFBConfig 9 #define GLXBadPbuffer 10 @@ -65,7 +65,7 @@ ** event - this helps initialization if the server supports the pbuffer ** extension and the client doesn't. */ -#define GLX_PbufferClobber 0 +#define GLX_PbufferClobber 0 #define __GLX_NUMBER_EVENTS 17 diff --git a/xc/include/Xos.h b/xc/include/Xos.h index 3b2c866a4..d3813318e 100644 --- a/xc/include/Xos.h +++ b/xc/include/Xos.h @@ -23,7 +23,7 @@ in this Software without prior written authorization from The Open Group. * The X Window System is a Trademark of The Open Group. * */ -/* $XFree86: xc/include/Xos.h,v 3.32 2001/02/15 18:20:28 dawes Exp $ */ +/* $XFree86: xc/include/Xos.h,v 3.33 2001/04/16 20:33:08 tsi Exp $ */ /* This is a collection of things to try and minimize system dependencies * in a "signficant" number of source files. @@ -298,7 +298,10 @@ typedef unsigned long fd_mask; #define NGROUPS 16 #endif -#if defined(ISC) || (defined(__QNX__) && !defined(UNIXCONN)) || defined(__CYGWIN__) +#if defined(ISC) || \ + (defined(linux) && !defined(__GLIBC__)) || \ + (defined(__QNX__) && !defined(UNIXCONN)) || \ + defined(__CYGWIN__) /* * Some OS's may not have this */ diff --git a/xc/include/extensions/Imakefile b/xc/include/extensions/Imakefile index 5f698cb90..b99dc739b 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.39 2001/03/25 05:31:58 tsi Exp $ +XCOMM $XFree86: xc/include/extensions/Imakefile,v 3.40 2001/04/23 16:17:06 tsi Exp $ #if BuildScreenSaverExt SCREENSAVERHEADERS = saver.h saverproto.h scrnsaver.h @@ -37,7 +37,7 @@ FONTCACHEHEADERS = fontcache.h fontcacheP.h fontcachstr.h #if BuildXinerama XINERAMAHEADERS = panoramiXext.h panoramiXproto.h Xinerama.h #endif -#if BuildRender +#if BuildRender || BuildXftLibrary RENDERHEADERS = render.h renderproto.h #endif diff --git a/xc/include/extensions/XvMCproto.h b/xc/include/extensions/XvMCproto.h index 34405f056..9ef855e68 100644 --- a/xc/include/extensions/XvMCproto.h +++ b/xc/include/extensions/XvMCproto.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/include/extensions/XvMCproto.h,v 1.3 2001/04/01 13:59:59 tsi Exp $ */ +/* $XFree86: xc/include/extensions/XvMCproto.h,v 1.4 2001/04/10 00:28:24 mvojkovi Exp $ */ #ifndef _XVMCPROTO_H_ #define _XVMCPROTO_H_ @@ -197,7 +197,6 @@ typedef struct { CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; - CARD32 padl7 B32; } xvmcListSubpictureTypesReply; #define sz_xvmcListSubpictureTypesReply 32 diff --git a/xc/lib/FS/Imakefile b/xc/lib/FS/Imakefile index e297d0d22..b0fb7a817 100644 --- a/xc/lib/FS/Imakefile +++ b/xc/lib/FS/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.4 2000/08/17 19:44:07 cpqbld Exp $ -XCOMM $XFree86: xc/lib/FS/Imakefile,v 3.5 2001/01/17 19:41:28 dawes Exp $ +XCOMM $XFree86: xc/lib/FS/Imakefile,v 3.6 2001/04/23 16:17:06 tsi Exp $ #define DoNormalLib NormalLibFS #define DoSharedLib SharedLibFS @@ -19,7 +19,7 @@ XCOMM $XFree86: xc/lib/FS/Imakefile,v 3.5 2001/01/17 19:41:28 dawes Exp $ DEFINES = -DMALLOC_0_RETURNS_NULL #endif -DEPEND_DEFINES = $(TRANS_INCLUDES) $(CONN_DEFINES) +DEPEND_DEFINES = $(TRANS_INCLUDES) $(CONN_DEFINES) DependDefines HEADERS = FSlib.h diff --git a/xc/lib/GL/dri/dri_glx.c b/xc/lib/GL/dri/dri_glx.c index 20884c16b..75b3347b3 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.7 2000/09/26 15:56:45 tsi Exp $ */ +/* $XFree86: xc/lib/GL/dri/dri_glx.c,v 1.8 2001/04/10 16:07:49 dawes Exp $ */ /* * Authors: @@ -46,6 +46,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <dlfcn.h> #include "dri_glx.h" #include <sys/types.h> +#include <stdarg.h> typedef void *(*CreateScreenFunc)(Display *dpy, int scrn, __DRIscreen *psc, @@ -68,6 +69,43 @@ extern void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, #endif +static void InfoMessageF(const char *f, ...) +{ + va_list args; + const char *env; + + if ((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose")) { + fprintf(stderr, "libGL: "); + va_start(args, f); + vfprintf(stderr, f, args); + va_end(args); + } +} + +static void ErrorMessageF(const char *f, ...) +{ + va_list args; + + if (getenv("LIBGL_DEBUG")) { + fprintf(stderr, "libGL error: "); + va_start(args, f); + vfprintf(stderr, f, args); + va_end(args); + } +} + +static void PrintF(const char *f, ...) +{ + va_list args; + const char *env; + + if ((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose")) { + va_start(args, f); + vfprintf(stderr, f, args); + va_end(args); + } +} + static void ErrorMessage(const char *msg) { if (getenv("LIBGL_DEBUG")) { @@ -180,22 +218,19 @@ static void *OpenDriver(const char *driverName) libPaths = DEFAULT_DRIVER_DIR; for (i = 0; ; i++) { - char libDir[1000], info[1000], realDriverName[100]; + char libDir[1000], realDriverName[200]; void *handle; ExtractDir(i, libPaths, 1000, libDir); if (!libDir[0]) return NULL; - sprintf(realDriverName, "%s/%s_dri.so", libDir, driverName); - sprintf(info, "trying %s", realDriverName); - InfoMessage(info); + snprintf(realDriverName, 200, "%s/%s_dri.so", libDir, driverName); + InfoMessageF("trying %s\n", realDriverName); handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL); if (handle) { return handle; } else { - char message[1000]; - snprintf(message, 1000, "dlopen failed: %s", dlerror()); - ErrorMessage(message); + ErrorMessageF("dlopen failed: %s\n", dlerror()); } } @@ -246,9 +281,7 @@ static void Find_CreateScreenFuncs(Display *dpy, b = XF86DRIGetClientDriverName(dpy, scrn, &driverMajor, &driverMinor, &driverPatch, &driverName); if (!b) { - char message[1000]; - snprintf(message, 1000, "Cannot determine driver name for screen %d", scrn); - ErrorMessage(message); + ErrorMessageF("Cannot determine driver name for screen %d\n", scrn); continue; } @@ -265,7 +298,7 @@ static void Find_CreateScreenFuncs(Display *dpy, /* success! */ createFuncs[scrn] = createScreenFunc; libraryHandles[scrn] = handle; - break; /* onto the next screen */ + continue; /* onto the next screen */ } else { ErrorMessage("driCreateScreen() not defined in driver!"); @@ -366,7 +399,6 @@ void *driCreateDisplay(Display *dpy, __DRIdisplay *pdisp) static void register_extensions_on_screen(Display *dpy, int scrNum) { - GLboolean verbose = GL_FALSE; /* for debugging only */ int eventBase, errorBase; Bool b, b2; int driMajor, driMinor, driPatch; @@ -380,34 +412,29 @@ register_extensions_on_screen(Display *dpy, int scrNum) */ b = XF86DRIQueryExtension(dpy, &eventBase, &errorBase); if (!b) { - if (verbose) - fprintf(stderr, "XF86DRIQueryExtension failed\n"); + InfoMessage("XF86DRIQueryExtension failed"); return; } b = XF86DRIQueryDirectRenderingCapable(dpy, scrNum, &b2); if (!b || !b2) { - if (verbose) - fprintf(stderr, "XF86DRIQueryDirectRenderingCapable failed\n"); + InfoMessage("XF86DRIQueryDirectRenderingCapable failed"); return; } b = XF86DRIQueryVersion(dpy, &driMajor, &driMinor, &driPatch); if (!b) { - if (verbose) - fprintf(stderr, "XF86DRIQueryVersion failed\n"); - return; + InfoMessage("XF86DRIQueryVersion failed"); } b = XF86DRIGetClientDriverName(dpy, scrNum, &driverMajor, &driverMinor, &driverPatch, &driverName); if (!b) { - if (verbose) - fprintf(stderr, "XF86DRIGetClientDriverName failed\n"); + InfoMessage("XF86DRIGetClientDriverName failed"); return; } - else if (verbose) { - printf("XF86DRIGetClientDriverName: %d.%d.%d %s\n", driverMajor, + else { + InfoMessageF("XF86DRIGetClientDriverName: %d.%d.%d %s\n", driverMajor, driverMinor, driverPatch, driverName); } @@ -446,8 +473,10 @@ void __glXRegisterExtensions(void) { static GLboolean alreadyCalled = GL_FALSE; - if (alreadyCalled) + + if (alreadyCalled) { return; + } #ifndef BUILT_IN_DRI_DRIVER { diff --git a/xc/lib/GL/dri/drm/Imakefile b/xc/lib/GL/dri/drm/Imakefile index 769b08355..274540f16 100644 --- a/xc/lib/GL/dri/drm/Imakefile +++ b/xc/lib/GL/dri/drm/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/GL/dri/drm/Imakefile,v 1.15 2001/04/03 02:29:32 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/dri/drm/Imakefile,v 1.16 2001/04/23 19:02:11 alanh Exp $ #if GlxUseBuiltInDRIDriver #define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) @@ -42,7 +42,7 @@ OS_SUBDIR = cygwin OS_SUBDIR2 = cygwin #endif -LinkSourceFile(xf86drm.c,$(XF86OSSRC)/$(OS_SUBDIR)/drm) +LinkSourceFile(xf86drm.c,$(XF86OSSRC)/$(OS_SUBDIR2)/drm) LinkSourceFile(xf86drmHash.c,$(XF86OSSRC)/$(OS_SUBDIR2)/drm) LinkSourceFile(xf86drmRandom.c,$(XF86OSSRC)/$(OS_SUBDIR2)/drm) diff --git a/xc/lib/GL/glx/glxclient.h b/xc/lib/GL/glx/glxclient.h index 7bbb35745..0973bd682 100644 --- a/xc/lib/GL/glx/glxclient.h +++ b/xc/lib/GL/glx/glxclient.h @@ -30,9 +30,8 @@ ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. -** */ -/* $XFree86: xc/lib/GL/glx/glxclient.h,v 1.12 2001/03/21 16:04:39 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/glxclient.h,v 1.13 2001/04/10 16:07:49 dawes Exp $ */ /* * Direct rendering support added by Precision Insight, Inc. diff --git a/xc/lib/GL/glx/glxcmds.c b/xc/lib/GL/glx/glxcmds.c index 3376c188c..2bfcc1a8d 100644 --- a/xc/lib/GL/glx/glxcmds.c +++ b/xc/lib/GL/glx/glxcmds.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/glx/glxcmds.c,v 1.14 2001/03/21 16:04:39 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/glxcmds.c,v 1.15 2001/04/07 01:39:39 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 @@ -38,7 +38,7 @@ #include "glxclient.h" #include <extutil.h> #include <Xext.h> -#include <strings.h> +#include <string.h> #include "glapi.h" #ifdef GLX_DIRECT_RENDERING #include "indirect_init.h" diff --git a/xc/lib/GL/glx/glxext.c b/xc/lib/GL/glx/glxext.c index 233dce353..f25a8a9eb 100644 --- a/xc/lib/GL/glx/glxext.c +++ b/xc/lib/GL/glx/glxext.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/glx/glxext.c,v 1.12 2001/03/21 16:04:39 dawes Exp $ */ +/* $XFree86: xc/lib/GL/glx/glxext.c,v 1.13 2001/04/10 16:07:49 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are @@ -448,11 +448,14 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv) #ifdef GLX_DIRECT_RENDERING /* Initialize the direct rendering per screen data and functions */ - if (priv->driDisplay.private) + if (priv->driDisplay.private && + priv->driDisplay.createScreen && + priv->driDisplay.createScreen[i]) { psc->driScreen.private = - (*priv->driDisplay.createScreen)(dpy, i, &psc->driScreen, + (*(priv->driDisplay.createScreen[i]))(dpy, i, &psc->driScreen, psc->numConfigs, psc->configs); + } #endif } SyncHandle(); diff --git a/xc/lib/GL/mesa/dri/dri_mesa.c b/xc/lib/GL/mesa/dri/dri_mesa.c index 06846ac44..097872382 100644 --- a/xc/lib/GL/mesa/dri/dri_mesa.c +++ b/xc/lib/GL/mesa/dri/dri_mesa.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/dri/dri_mesa.c,v 1.15 2001/03/21 16:14:19 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/dri/dri_mesa.c,v 1.16 2001/04/10 16:07:49 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -459,7 +459,7 @@ static Bool driMesaBindContext(Display *dpy, int scrn, if (try) { if (psp->fullscreen && !psp->pSAREA->frame.fullscreen) { /* Server has closed fullscreen mode */ - __driMesaMessage("server closed fullscreen mode\n"); + __driMesaMessage("server closed fullscreen mode"); psp->fullscreen = NULL; } if (XF86DRIOpenFullScreen(dpy, scrn, draw)) { diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_dd.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_dd.c index 8b06ef77b..eb32c8a24 100644 --- a/xc/lib/GL/mesa/src/drv/ffb/ffb_dd.c +++ b/xc/lib/GL/mesa/src/drv/ffb/ffb_dd.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_dd.c,v 1.1 2000/06/20 05:08:38 dawes Exp $ +/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_dd.c,v 1.2 2001/04/10 16:07:50 dawes Exp $ * * GLX Hardware Device Driver for Sun Creator/Creator3D * Copyright (C) 2000 David S. Miller @@ -16,9 +16,9 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * @@ -53,7 +53,7 @@ static const GLubyte *ffbDDGetString(GLcontext *ctx, GLenum name) case GL_VENDOR: return (GLubyte *) "David S. Miller"; case GL_RENDERER: - return (GLubyte *) "DRI-FFB"; + return (GLubyte *) "Mesa DRI FFB 20010321"; default: return NULL; }; diff --git a/xc/lib/GL/mesa/src/drv/i810/i810dd.c b/xc/lib/GL/mesa/src/drv/i810/i810dd.c index eb78a91c6..910108010 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810dd.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810dd.c @@ -15,13 +15,13 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810dd.c,v 1.4 2000/09/24 13:51:04 alanh Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810dd.c,v 1.5 2001/04/10 16:07:50 dawes Exp $ */ #include "types.h" #include "vbrender.h" @@ -56,7 +56,7 @@ static const GLubyte *i810DDGetString( GLcontext *ctx, GLenum name ) case GL_VENDOR: return (GLubyte *)"Keith Whitwell, Precision Insight Inc."; case GL_RENDERER: - return (GLubyte *)"Mesa DRI I810 20000510"; + return (GLubyte *)"Mesa DRI I810 20010321"; default: return 0; } @@ -65,10 +65,10 @@ static const GLubyte *i810DDGetString( GLcontext *ctx, GLenum name ) static GLint i810GetParameteri(const GLcontext *ctx, GLint param) { switch (param) { - case DD_HAVE_HARDWARE_FOG: + case DD_HAVE_HARDWARE_FOG: return 1; default: - return 0; + return 0; } } @@ -76,7 +76,7 @@ static GLint i810GetParameteri(const GLcontext *ctx, GLint param) static void i810BufferSize(GLcontext *ctx, GLuint *width, GLuint *height) { - i810ContextPtr imesa = I810_CONTEXT(ctx); + i810ContextPtr imesa = I810_CONTEXT(ctx); /* Need to lock to make sure the driDrawable is uptodate. This * information is used to resize Mesa's software buffers, so it has @@ -104,19 +104,19 @@ void i810DDExtensionsInit( GLcontext *ctx ) /* The imaging subset of 1.2 isn't supported by any mesa driver. */ gl_extensions_disable( ctx, "ARB_imaging" ); - gl_extensions_disable( ctx, "GL_ARB_texture_compression" ); - gl_extensions_disable( ctx, "GL_ARB_texture_cube_map" ); + gl_extensions_disable( ctx, "GL_ARB_texture_compression" ); + gl_extensions_disable( ctx, "GL_ARB_texture_cube_map" ); gl_extensions_disable( ctx, "GL_EXT_blend_color" ); gl_extensions_disable( ctx, "GL_EXT_blend_logic_op" ); gl_extensions_disable( ctx, "GL_EXT_blend_minmax" ); gl_extensions_disable( ctx, "GL_EXT_blend_subtract" ); - gl_extensions_disable( ctx, "GL_EXT_convolution" ); - gl_extensions_disable( ctx, "GL_EXT_texture_lod_bias" ); + gl_extensions_disable( ctx, "GL_EXT_convolution" ); + gl_extensions_disable( ctx, "GL_EXT_texture_lod_bias" ); gl_extensions_disable( ctx, "GL_INGR_blend_func_separate" ); - gl_extensions_disable( ctx, "GL_MESA_resize_buffers" ); - gl_extensions_disable( ctx, "GL_SGIX_pixel_texture" ); - gl_extensions_disable( ctx, "GL_SGI_color_matrix" ); - gl_extensions_disable( ctx, "GL_SGI_color_table" ); + gl_extensions_disable( ctx, "GL_MESA_resize_buffers" ); + gl_extensions_disable( ctx, "GL_SGIX_pixel_texture" ); + gl_extensions_disable( ctx, "GL_SGI_color_matrix" ); + gl_extensions_disable( ctx, "GL_SGI_color_table" ); /* We do support tex_env_add, however */ diff --git a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c index b12a6eb40..94b0c6b6f 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c @@ -1,35 +1,29 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c,v 1.11 2001/03/21 16:14:21 dawes Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c,v 1.12 2001/04/10 16:07:50 dawes Exp $ */ /* - * Authors: - * Keith Whitwell <keithw@precisioninsight.com> + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * + * Authors: + * Keith Whitwell <keithw@valinux.com> */ #ifdef GLX_DIRECT_RENDERING @@ -61,18 +55,16 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "mga_dri.h" - - - #ifndef MGA_DEBUG int MGA_DEBUG = (0 -/* | DEBUG_ALWAYS_SYNC */ - | DEBUG_VERBOSE_MSG -/* | DEBUG_VERBOSE_LRU */ - | DEBUG_VERBOSE_DRI - | DEBUG_VERBOSE_IOCTL -/* | DEBUG_VERBOSE_2D */ - ); +/* | DEBUG_ALWAYS_SYNC */ +/* | DEBUG_VERBOSE_MSG */ +/* | DEBUG_VERBOSE_LRU */ +/* | DEBUG_VERBOSE_DRI */ +/* | DEBUG_VERBOSE_IOCTL */ +/* | DEBUG_VERBOSE_2D */ +/* | DEBUG_VERBOSE_FALLBACK */ + ); #endif diff --git a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h index a785d83af..68c075555 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h +++ b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h @@ -1,36 +1,30 @@ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h,v 1.8 2001/04/01 13:59:59 tsi Exp $ */ - /* - * Authors: - * Keith Whitwell <keithw@precisioninsight.com> + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keithw@valinux.com> */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h,v 1.9 2001/04/10 16:07:50 dawes Exp $ */ #ifndef _MGA_INIT_H_ #define _MGA_INIT_H_ diff --git a/xc/lib/GL/mesa/src/drv/mga/mgabuffers.c b/xc/lib/GL/mesa/src/drv/mga/mgabuffers.c index 0e53b2f41..731afb75a 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgabuffers.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgabuffers.c @@ -1,37 +1,30 @@ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgabuffers.c,v 1.6 2001/03/21 16:14:22 dawes Exp $ */ - /* - * Authors: - * Keith Whitwell <keithw@precisioninsight.com> + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: * - * $PI: $ + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keithw@valinux.com> */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgabuffers.c,v 1.7 2001/04/10 16:07:50 dawes Exp $ */ #include <stdio.h> #include "mgacontext.h" diff --git a/xc/lib/GL/mesa/src/drv/mga/mgabuffers.h b/xc/lib/GL/mesa/src/drv/mga/mgabuffers.h index 2a72aba6f..28dba8735 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgabuffers.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgabuffers.h @@ -1,4 +1,30 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgabuffers.h,v 1.3 2000/08/25 13:42:23 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgabuffers.h,v 1.4 2001/04/10 16:07:50 dawes Exp $ */ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keithw@valinux.com> + */ #ifndef MGA_BUFFERS_H #define MGA_BUFFERS_H diff --git a/xc/lib/GL/mesa/src/drv/mga/mgacontext.h b/xc/lib/GL/mesa/src/drv/mga/mgacontext.h index 124da2f26..2462a54a7 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgacontext.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgacontext.h @@ -1,31 +1,31 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgacontext.h,v 1.3 2001/03/21 16:14:22 dawes Exp $*/ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgacontext.h,v 1.4 2001/04/10 16:07:50 dawes Exp $*/ /* - * GLX Hardware Device Driver for Matrox Millenium G200 - * Copyright (C) 1999 Wittawat Yamwong + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, 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: + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * - * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de> + * Authors: + * Keith Whitwell <keithw@valinux.com> */ - #ifndef MGALIB_INC #define MGALIB_INC @@ -277,12 +277,13 @@ struct mga_context_t { extern int MGA_DEBUG; #endif -#define DEBUG_ALWAYS_SYNC 0x1 -#define DEBUG_VERBOSE_MSG 0x2 -#define DEBUG_VERBOSE_LRU 0x4 -#define DEBUG_VERBOSE_DRI 0x8 -#define DEBUG_VERBOSE_IOCTL 0x10 -#define DEBUG_VERBOSE_2D 0x20 +#define DEBUG_ALWAYS_SYNC 0x1 +#define DEBUG_VERBOSE_MSG 0x2 +#define DEBUG_VERBOSE_LRU 0x4 +#define DEBUG_VERBOSE_DRI 0x8 +#define DEBUG_VERBOSE_IOCTL 0x10 +#define DEBUG_VERBOSE_2D 0x20 +#define DEBUG_VERBOSE_FALLBACK 0x40 static __inline__ GLuint mgaPackColor(GLuint cpp, GLubyte r, GLubyte g, diff --git a/xc/lib/GL/mesa/src/drv/mga/mgadd.c b/xc/lib/GL/mesa/src/drv/mga/mgadd.c index 8c4efa77d..706e14bc8 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgadd.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgadd.c @@ -1,30 +1,30 @@ /* - * GLX Hardware Device Driver for Matrox G200/G400 - * Copyright (C) 1999 Wittawat Yamwong + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, 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: + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * - * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de> + * Authors: + * Keith Whitwell <keithw@valinux.com> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgadd.c,v 1.9 2001/04/01 13:59:59 tsi Exp $ */ - +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgadd.c,v 1.10 2001/04/10 16:07:50 dawes Exp $ */ #include "types.h" @@ -51,7 +51,7 @@ #include "X86/common_x86_asm.h" #endif -#define MGA_DATE "20010316" +#define MGA_DATE "20010321" diff --git a/xc/lib/GL/mesa/src/drv/mga/mgadd.h b/xc/lib/GL/mesa/src/drv/mga/mgadd.h index 0bd4c712e..c6e27f8a6 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgadd.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgadd.h @@ -1,30 +1,31 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgadd.h,v 1.2 2001/04/10 16:07:50 dawes Exp $ */ /* - * GLX Hardware Device Driver for Matrox Millenium G200 - * Copyright (C) 1999 Wittawat Yamwong + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, 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: + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * - * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de> + * Authors: + * Keith Whitwell <keithw@valinux.com> */ - #ifndef MGADD_INC #define MGADD_INC diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaeltpath.c b/xc/lib/GL/mesa/src/drv/mga/mgaeltpath.c index 50eb1a64e..254d0b168 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaeltpath.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgaeltpath.c @@ -1,27 +1,30 @@ /* - * GLX Hardware Device Driver for Matrox G400 - * Copyright (C) 1999 Keith Whitwell + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, 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: + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * + * Authors: + * Keith Whitwell <keithw@valinux.com> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaeltpath.c,v 1.6 2001/03/21 16:14:22 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaeltpath.c,v 1.7 2001/04/10 16:07:50 dawes Exp $ */ #include <stdio.h> diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaelttmp.h b/xc/lib/GL/mesa/src/drv/mga/mgaelttmp.h index 2bc19ddcd..4016b12ca 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaelttmp.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgaelttmp.h @@ -1,30 +1,33 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaelttmp.h,v 1.4 2001/04/10 16:07:50 dawes Exp $ */ /* - * DRI Hardware Device Driver for G200/G400 - * Copyright (C) 1999 Keith Whitwell + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, 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: + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * + * Authors: + * Keith Whitwell <keithw@valinux.com> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaelttmp.h,v 1.3 2000/08/28 02:43:12 tsi Exp $ */ /* Buffers fill from high addresses down with vertices and from low - * addresses up with elements. + * addresses up with elements. */ @@ -55,14 +58,14 @@ static void TAG(emit_unclipped_verts)( struct vertex_buffer *VB ) mmesa->retained_buf = mmesa->elt_buf; mmesa->first_vert_phys = mmesa->next_vert_phys; - for (i = 0 ; i < count ; f -= BUFFER_STRIDE, i++) + for (i = 0 ; i < count ; f -= BUFFER_STRIDE, i++) { - if (!clipmask[i]) + if (!clipmask[i]) { f[0] = sx * dev[0] + tx; f[1] = sy * dev[1] + ty; f[2] = sz * dev[2] + tz; - f[3] = dev[3]; + f[3] = dev[3]; if (TYPE & MGA_RGBA_BIT) { #if defined(USE_X86_ASM) @@ -107,12 +110,12 @@ static void TAG(emit_unclipped_verts)( struct vertex_buffer *VB ) /* Build three temporary clipspace vertex for clipping a triangle. * Recreate from the VB data rather than trying to read back from - * uncached memory. + * uncached memory. */ static void TAG(build_tri_verts)( mgaContextPtr mmesa, - struct vertex_buffer *VB, - GLfloat *O, - GLuint *elt ) + struct vertex_buffer *VB, + GLfloat *O, + GLuint *elt ) { int i; @@ -121,7 +124,7 @@ static void TAG(build_tri_verts)( mgaContextPtr mmesa, O[0] = clip[0]; O[1] = clip[1]; - O[2] = clip[2]; + O[2] = clip[2]; O[3] = clip[3]; if (TYPE & MGA_RGBA_BIT) { @@ -163,7 +166,7 @@ static void TAG(build_tri_verts)( mgaContextPtr mmesa, /* Interpolate between two of the vertices constructed above. */ -static void TAG(interp)( GLfloat t, +static void TAG(interp)( GLfloat t, GLfloat *O, const GLfloat *I, const GLfloat *J ) @@ -181,7 +184,7 @@ static void TAG(interp)( GLfloat t, } *(GLuint *)&O[5] = ~0; /* note that this is a new vertex */ - + if (TYPE & MGA_TEX0_BIT) { O[6] = LINTERP(t, I[6], J[6]); O[7] = LINTERP(t, I[7], J[7]); @@ -204,7 +207,7 @@ static void TAG(project_and_emit_verts)( mgaContextPtr mmesa, GLuint *elt, int nr) { - + GLfloat *O = mmesa->next_vert; GLuint phys = mmesa->next_vert_phys; @@ -212,27 +215,27 @@ static void TAG(project_and_emit_verts)( mgaContextPtr mmesa, const GLfloat sx = m[0], sy = m[5], sz = m[10]; const GLfloat tx = m[12], ty = m[13], tz = m[14]; GLuint i; - + for (i = 0 ; i < nr ; i++) { const GLfloat *I = &verts[elt[i] * CLIP_STRIDE]; GLuint tmp = *(GLuint *)&I[5]; - if ((elt[i] = tmp) == ~0) - { + if ((elt[i] = tmp) == ~0) + { GLfloat oow = 1.0/I[3]; elt[i] = phys; phys -= BUFFER_STRIDE * sizeof(GLuint); - + O[0] = sx * I[0] * oow + tx; O[1] = sy * I[1] * oow + ty; O[2] = sz * I[2] * oow + tz; - O[3] = oow; + O[3] = oow; if (TYPE & MGA_RGBA_BIT) { *(int*)&O[4] = *(int*)&I[4]; } - + if (TYPE & MGA_TEX0_BIT) { *(int*)&O[6] = *(int*)&I[6]; *(int*)&O[7] = *(int*)&I[7]; diff --git a/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c b/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c index a1e9b04ce..0eac06f68 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c @@ -1,27 +1,30 @@ /* - * GLX Hardware Device Driver for Intel i810 - * Copyright (C) 1999 Keith Whitwell + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, 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: + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * + * Authors: + * Keith Whitwell <keithw@valinux.com> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgafastpath.c,v 1.7 2001/03/21 16:14:22 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgafastpath.c,v 1.8 2001/04/10 16:07:50 dawes Exp $ */ #include <stdio.h> @@ -489,7 +492,6 @@ void mgaDDFastPath( struct vertex_buffer *VB ) gl_prepare_arrays_cva( VB ); /* still need this */ -#if 1 if (gl_reduce_prim[prim] == GL_TRIANGLES && VB->Count < (MGA_BUFFER_SIZE / 48) && (ctx->ModelProjectMatrix.flags & (MAT_FLAG_GENERAL| @@ -499,7 +501,6 @@ void mgaDDFastPath( struct vertex_buffer *VB ) mgaDDEltPath( VB ); return; } -#endif /* Reserve enough space for the pathological case. */ diff --git a/xc/lib/GL/mesa/src/drv/mga/mgafasttmp.h b/xc/lib/GL/mesa/src/drv/mga/mgafasttmp.h index 683640409..b49105a8c 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgafasttmp.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgafasttmp.h @@ -1,29 +1,32 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgafasttmp.h,v 1.3 2001/04/10 16:07:50 dawes Exp $ */ /* - * DRI Hardware Device Driver for G200/G400 - * Copyright (C) 1999 Keith Whitwell + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, 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: + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * + * Authors: + * Keith Whitwell <keithw@valinux.com> */ - /* The first part of setup is applied to all vertices, clipped or * unclipped. This data will be used for clipping, and then all * vertices with a zero clipmask will be projected to device space. @@ -41,14 +44,14 @@ static void TAG(mga_setup_full)( struct vertex_buffer *VB, GLuint do_cliptest ) GLuint count = VB->Count; gl_xform_points3_v16_general(MGA_DRIVER_DATA(VB)->verts[start].f, - m, + m, VB->ObjPtr->start, VB->ObjPtr->stride, count - start); if (do_cliptest) { - VB->ClipAndMask = ~0; + VB->ClipAndMask = ~0; VB->ClipOrMask = 0; gl_cliptest_points4_v16(MGA_DRIVER_DATA(VB)->verts[start].f, MGA_DRIVER_DATA(VB)->verts[count].f, @@ -121,7 +124,7 @@ static void TAG(mga_setup_full)( struct vertex_buffer *VB, GLuint do_cliptest ) #else *(unsigned int *)(f+CLIP_S1) = *(unsigned int *)tex1_data; *(unsigned int *)(f+CLIP_T1) = *(unsigned int *)(tex1_data+1); -#endif +#endif } if(TYPE & MGA_RGBA_BIT)color += color_stride; if(TYPE & MGA_TEX0_BIT)STRIDE_F(tex0_data, tex0_stride); @@ -139,7 +142,7 @@ static void TAG(mga_setup_full)( struct vertex_buffer *VB, GLuint do_cliptest ) * routine into the header. Less code and better chance of doing some * of this stuff in assembly. */ -static void TAG(mga_interp_vert)( GLfloat t, +static void TAG(mga_interp_vert)( GLfloat t, GLfloat *O, const GLfloat *I, const GLfloat *J ) diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c index 719595449..b07e69271 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c @@ -1,4 +1,31 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaioctl.c,v 1.10 2001/03/21 16:14:22 dawes Exp $ */ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keithw@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaioctl.c,v 1.11 2001/04/10 16:07:50 dawes Exp $ */ #include <stdio.h> @@ -273,6 +300,7 @@ void mgaSwapBuffers( mgaContextPtr mmesa ) MGA_READ( MGAREG_PRIMADDRESS ) - mmesa->primary_offset, mmesa->sarea->last_wrap ); } + UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH ); for ( i = 0 ; i < 1024 ; i++ ) { /* Don't just hammer the register... */ @@ -379,6 +407,8 @@ static void age_mmesa( mgaContextPtr mmesa, int age ) if (mmesa->CurrentTexObj[1]) mmesa->CurrentTexObj[1]->age = age; } +static int __break_vertex = 0; + void mgaFlushVerticesLocked( mgaContextPtr mmesa ) { XF86DRIClipRectPtr pbox = mmesa->pClipRects; @@ -465,6 +495,13 @@ void mgaFlushVerticesLocked( mgaContextPtr mmesa ) } } + /* Do we really need to do this ? */ +#ifdef __i386__ + if ( __break_vertex ) { + __asm__ __volatile__ ( "int $3" ); + } +#endif + mmesa->dirty &= ~MGA_UPLOAD_CLIPRECTS; } diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h index bb3f4f45f..ad2e6d1ed 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h @@ -1,4 +1,31 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaioctl.h,v 1.7 2001/03/21 16:14:22 dawes Exp $ */ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keithw@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaioctl.h,v 1.8 2001/04/10 16:07:50 dawes Exp $ */ #ifndef MGA_IOCTL_H #define MGA_IOCTL_H diff --git a/xc/lib/GL/mesa/src/drv/mga/mgapipeline.c b/xc/lib/GL/mesa/src/drv/mga/mgapipeline.c index 1f5288de5..cf2843df5 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgapipeline.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgapipeline.c @@ -1,4 +1,30 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgapipeline.c,v 1.3 2000/09/26 15:56:47 tsi Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgapipeline.c,v 1.4 2001/04/10 16:07:50 dawes Exp $ */ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keithw@valinux.com> + */ #include <stdio.h> #include "mgavb.h" @@ -13,7 +39,7 @@ static struct gl_pipeline_stage mga_fast_stage = { (PIPE_OP_VERT_XFORM|PIPE_OP_RAST_SETUP_0| PIPE_OP_RAST_SETUP_1|PIPE_OP_RENDER), PIPE_PRECALC, - 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, mgaDDFastPath }; @@ -27,17 +53,17 @@ static struct gl_pipeline_stage mga_fast_stage = { ENABLE_USERCLIP | \ ENABLE_LIGHT | \ ENABLE_FOG) - + /* The driver gets first shot at building the pipeline - make some * quick tests to see if we can use the fast path. */ GLboolean mgaDDBuildPrecalcPipeline( GLcontext *ctx ) -{ +{ struct gl_pipeline *pipe = &ctx->CVA.pre; mgaContextPtr mmesa = MGA_CONTEXT( ctx ); - - if (mmesa->renderindex == 0 && + + if (mmesa->renderindex == 0 && (ctx->Enabled & ILLEGAL_ENABLES) == 0 && (ctx->Array.Flags & (VERT_OBJ_234| VERT_TEX0_4| @@ -50,9 +76,9 @@ GLboolean mgaDDBuildPrecalcPipeline( GLcontext *ctx ) pipe->ops = pipe->stages[0]->ops; mmesa->using_fast_path = 1; return 1; - } + } - if (mmesa->using_fast_path) + if (mmesa->using_fast_path) { mmesa->using_fast_path = 0; ctx->CVA.VB->ClipOrMask = 0; @@ -60,7 +86,7 @@ GLboolean mgaDDBuildPrecalcPipeline( GLcontext *ctx ) ctx->Array.NewArrayState |= ctx->Array.Summary; return 0; } - + return 0; } @@ -68,7 +94,7 @@ GLboolean mgaDDBuildPrecalcPipeline( GLcontext *ctx ) /* Still do the normal fixup and copy-to-current, so this isn't so - * bad. + * bad. */ #define ILLEGAL_INPUTS_IMM (VERT_OBJ_4| \ VERT_TEX0_4| \ @@ -134,5 +160,3 @@ GLuint mgaDDRegisterPipelineStages( struct gl_pipeline_stage *out, return o; } - - diff --git a/xc/lib/GL/mesa/src/drv/mga/mgapipeline.h b/xc/lib/GL/mesa/src/drv/mga/mgapipeline.h index dc0179227..ab961a895 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgapipeline.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgapipeline.h @@ -1,3 +1,31 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgapipeline.h,v 1.3 2001/04/10 16:07:50 dawes Exp $ */ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keithw@valinux.com> + */ + #ifndef _MGA_PIPELINE_H #define _MGA_PIPELINE_H diff --git a/xc/lib/GL/mesa/src/drv/mga/mgapixel.c b/xc/lib/GL/mesa/src/drv/mga/mgapixel.c index d4732831c..231d7b9e7 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgapixel.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgapixel.c @@ -1,29 +1,31 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgapixel.c,v 1.2 2001/03/21 16:14:22 dawes Exp $ */ -/************************************************************************** - -Copyright 2000 Compaq Computer Inc. and VA Linux, Inc. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -on the rights to use, copy, modify, merge, publish, distribute, sub -license, and/or sell copies of the Software, and to permit persons to whom -the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice (including the next -paragraph) shall be included in all copies or substantial portions of the -Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL -ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ +/* + * Copyright 2000 Compaq Computer Inc. and VA Linux Systems, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keithw@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgapixel.c,v 1.3 2001/04/10 16:07:51 dawes Exp $ */ #include "enums.h" #include "types.h" @@ -35,14 +37,14 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "mgabuffers.h" #include "drm.h" -#include <sys/ioctl.h> -#define IS_AGP_MEM(mmesa, p) \ - (mmesa->mgaScreen->agp.map <= ((char *)p) && \ - mmesa->mgaScreen->agp.map + \ - mmesa->mgaScreen->agp.size > ((char *)p)) -#define AGP_OFFSET(mmesa, p) \ - (((char *)p) - mmesa->mgaScreen->agp.map ) +#define IS_AGP_MEM( mmesa, p ) \ + ((GLuint)mmesa->mgaScreen->buffers.map <= ((GLuint)p) && \ + (GLuint)mmesa->mgaScreen->buffers.map + \ + (GLuint)mmesa->mgaScreen->buffers.size > ((GLuint)p)) + +#define AGP_OFFSET( mmesa, p ) \ + (((GLuint)p) - (GLuint)mmesa->mgaScreen->buffers.map ) #if defined(MESA_packed_depth_stencil) @@ -54,20 +56,19 @@ check_depth_stencil_24_8( const GLcontext *ctx, GLenum type, { mgaContextPtr mmesa = MGA_CONTEXT(ctx); - return (type == GL_UNSIGNED_INT_24_8_MESA && - ctx->Visual->DepthBits == 24 && - ctx->Visual->StencilBits == 8 && - mmesa->mgaScreen->cpp == 4 && - mmesa->hw_stencil && - !ctx->Pixel.IndexShift && - !ctx->Pixel.IndexOffset && - !ctx->Pixel.MapStencilFlag && - ctx->Pixel.DepthBias == 0.0 && - ctx->Pixel.DepthScale == 1.0 && - !packing->SwapBytes && - pitch % 32 == 0 && - pitch < 4096); - + return ( type == GL_UNSIGNED_INT_24_8_MESA && + ctx->Visual->DepthBits == 24 && + ctx->Visual->StencilBits == 8 && + mmesa->mgaScreen->cpp == 4 && + mmesa->hw_stencil && + !ctx->Pixel.IndexShift && + !ctx->Pixel.IndexOffset && + !ctx->Pixel.MapStencilFlag && + ctx->Pixel.DepthBias == 0.0 && + ctx->Pixel.DepthScale == 1.0 && + !packing->SwapBytes && + pitch % 32 == 0 && + pitch < 4096 ); } #endif @@ -79,69 +80,70 @@ check_depth( const GLcontext *ctx, GLenum type, { mgaContextPtr mmesa = MGA_CONTEXT(ctx); - if (IS_AGP_MEM(mmesa, pixels) && - !((type == GL_UNSIGNED_INT && mmesa->mgaScreen->cpp == 4) || - (type == GL_UNSIGNED_SHORT && mmesa->mgaScreen->cpp == 2))) + if ( IS_AGP_MEM( mmesa, pixels ) && + !( ( type == GL_UNSIGNED_INT && mmesa->mgaScreen->cpp == 4 ) || + ( type == GL_UNSIGNED_SHORT && mmesa->mgaScreen->cpp == 2 ) ) ) return GL_FALSE; - return (ctx->Pixel.DepthBias == 0.0 && - ctx->Pixel.DepthScale == 1.0 && - !packing->SwapBytes && - pitch % 32 == 0 && - pitch < 4096); + return ( ctx->Pixel.DepthBias == 0.0 && + ctx->Pixel.DepthScale == 1.0 && + !packing->SwapBytes && + pitch % 32 == 0 && + pitch < 4096 ); } static GLboolean check_color( const GLcontext *ctx, GLenum type, GLenum format, - const struct gl_pixelstore_attrib *packing, - const void *pixels, GLint sz, GLint pitch ) + const struct gl_pixelstore_attrib *packing, + const void *pixels, GLint sz, GLint pitch ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); GLuint cpp = mmesa->mgaScreen->cpp; /* Can't do conversions on agp reads/draws. */ - if (IS_AGP_MEM(mmesa, pixels) && - !(pitch % 32 == 0 && - pitch < 4096 && - ((type == GL_UNSIGNED_BYTE && cpp == 4 && format == GL_BGRA) || - (type == GL_UNSIGNED_INT_8_8_8_8 && cpp == 4 && format == GL_BGRA) || - (type == GL_UNSIGNED_SHORT_5_6_5_REV && cpp==2 && format == GL_RGB)))) + if ( IS_AGP_MEM( mmesa, pixels ) && + !( pitch % 32 == 0 && pitch < 4096 && + ( ( type == GL_UNSIGNED_BYTE && + cpp == 4 && format == GL_BGRA ) || + ( type == GL_UNSIGNED_INT_8_8_8_8 && + cpp == 4 && format == GL_BGRA ) || + ( type == GL_UNSIGNED_SHORT_5_6_5_REV && + cpp == 2 && format == GL_RGB ) ) ) ) return GL_FALSE; - return - (ctx->ColorMatrix.type == MATRIX_IDENTITY && - !ctx->Pixel.ScaleOrBiasRGBA && - !ctx->Pixel.ScaleOrBiasRGBApcm && - !ctx->Pixel.MapColorFlag && - !ctx->Pixel.ColorTableEnabled && - !ctx->Pixel.PostColorMatrixColorTableEnabled && - !ctx->Pixel.MinMaxEnabled && - !ctx->Pixel.HistogramEnabled && - !packing->SwapBytes && - !packing->LsbFirst); + return ( ctx->ColorMatrix.type == MATRIX_IDENTITY && + !ctx->Pixel.ScaleOrBiasRGBA && + !ctx->Pixel.ScaleOrBiasRGBApcm && + !ctx->Pixel.MapColorFlag && + !ctx->Pixel.ColorTableEnabled && + !ctx->Pixel.PostColorMatrixColorTableEnabled && + !ctx->Pixel.MinMaxEnabled && + !ctx->Pixel.HistogramEnabled && + !packing->SwapBytes && + !packing->LsbFirst ); } static GLboolean check_color_per_fragment_ops( const GLcontext *ctx ) { - return (!(ctx->RasterMask & ~(SCISSOR_BIT|WINCLIP_BIT|MULTI_DRAW_BIT)) && - ctx->Current.RasterPosValid && - ctx->Pixel.ZoomX == 1.0F && - (ctx->Pixel.ZoomY == 1.0F || ctx->Pixel.ZoomY == -1.0F)); + return ( !(ctx->RasterMask & ~(SCISSOR_BIT|WINCLIP_BIT|MULTI_DRAW_BIT)) && + ctx->Current.RasterPosValid && + ctx->Pixel.ZoomX == 1.0F && + ( ctx->Pixel.ZoomY == 1.0F || ctx->Pixel.ZoomY == -1.0F ) ); } static GLboolean check_depth_per_fragment_ops( const GLcontext *ctx ) { - return (ctx->Current.RasterPosValid && - ctx->Color.ColorMask[RCOMP] == 0 && - ctx->Color.ColorMask[BCOMP] == 0 && - ctx->Color.ColorMask[GCOMP] == 0 && - ctx->Color.ColorMask[ACOMP] == 0 && - ctx->Pixel.ZoomX == 1.0F && - (ctx->Pixel.ZoomY == 1.0F || ctx->Pixel.ZoomY == -1.0F)); + return ( ctx->Current.RasterPosValid && + ctx->Color.ColorMask[RCOMP] == 0 && + ctx->Color.ColorMask[BCOMP] == 0 && + ctx->Color.ColorMask[GCOMP] == 0 && + ctx->Color.ColorMask[ACOMP] == 0 && + ctx->Pixel.ZoomX == 1.0F && + ( ctx->Pixel.ZoomY == 1.0F || ctx->Pixel.ZoomY == -1.0F ) ); } /* In addition to the requirements for depth: @@ -150,8 +152,8 @@ check_depth_per_fragment_ops( const GLcontext *ctx ) static GLboolean check_stencil_per_fragment_ops( const GLcontext *ctx ) { - return (!ctx->Pixel.IndexShift && - !ctx->Pixel.IndexOffset); + return ( !ctx->Pixel.IndexShift && + !ctx->Pixel.IndexOffset ); } #endif diff --git a/xc/lib/GL/mesa/src/drv/mga/mgapixel.h b/xc/lib/GL/mesa/src/drv/mga/mgapixel.h index 4766c1409..c7bb04d92 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgapixel.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgapixel.h @@ -1,29 +1,30 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgapixel.h,v 1.2 2001/03/21 16:14:22 dawes Exp $ */ -/************************************************************************** - -Copyright 2000 Compaq Computer Inc. and VA Linux, Inc. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -on the rights to use, copy, modify, merge, publish, distribute, sub -license, and/or sell copies of the Software, and to permit persons to whom -the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice (including the next -paragraph) shall be included in all copies or substantial portions of the -Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL -ATI, PRECISION INSIGHT AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ +/* + * Copyright 2000-2001 Compaq Computer Inc. VA Linux Systems, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keithw@valinux.com> + */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgapixel.h,v 1.3 2001/04/10 16:07:51 dawes Exp $ */ #ifndef MGA_PIXELS_H #define MGA_PIXELS_H @@ -33,4 +34,3 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. extern void mgaDDInitPixelFuncs( GLcontext *ctx ); #endif - diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c index 0f53c6fda..2fb01b757 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c @@ -1,4 +1,30 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaspan.c,v 1.7 2001/03/21 16:14:22 dawes Exp $ */ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keithw@valinux.com> + */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaspan.c,v 1.8 2001/04/10 16:07:51 dawes Exp $ */ #include "types.h" #include "mgadd.h" diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaspan.h b/xc/lib/GL/mesa/src/drv/mga/mgaspan.h index 5db0fb976..16bbf2f67 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaspan.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgaspan.h @@ -1,3 +1,31 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgaspan.h,v 1.2 2001/04/10 16:07:51 dawes Exp $ */ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keithw@valinux.com> + */ + #ifndef _MGA_SPAN_H #define _MGA_SPAN_H diff --git a/xc/lib/GL/mesa/src/drv/mga/mgastate.c b/xc/lib/GL/mesa/src/drv/mga/mgastate.c index 6d2adb5ea..203a92f27 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgastate.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgastate.c @@ -1,4 +1,30 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgastate.c,v 1.8 2001/03/21 16:14:22 dawes Exp $ */ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keithw@valinux.com> + */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgastate.c,v 1.9 2001/04/10 16:07:51 dawes Exp $ */ #include <stdio.h> diff --git a/xc/lib/GL/mesa/src/drv/mga/mgastate.h b/xc/lib/GL/mesa/src/drv/mga/mgastate.h index ac92cb0c2..50ba3c363 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgastate.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgastate.h @@ -1,3 +1,31 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgastate.h,v 1.3 2001/04/10 16:07:51 dawes Exp $ */ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keithw@valinux.com> + */ + #ifndef _MGA_STATE_H #define _MGA_STATE_H diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatex.c b/xc/lib/GL/mesa/src/drv/mga/mgatex.c index e057dc50c..d99313c81 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatex.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgatex.c @@ -1,31 +1,30 @@ /* - * GLX Hardware Device Driver for Matrox Millenium G200 - * Copyright (C) 1999 Wittawat Yamwong + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, 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: + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * - * original by Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de> - * 9/20/99 rewrite by John Carmack <johnc@idsoftware.com> - * 13/1/00 port to DRI by Keith Whitwell <keithw@precisioninsight.com> + * Authors: + * Keith Whitwell <keithw@valinux.com> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatex.c,v 1.9 2001/03/21 16:14:22 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatex.c,v 1.10 2001/04/10 16:07:51 dawes Exp $ */ #include <stdlib.h> #include <stdio.h> @@ -539,6 +538,9 @@ static void mgaUpdateTextureEnvG400( GLcontext *ctx, int unit ) #else /* s/w fallback, pretty sure we can't do in h/w */ mmesa->Fallback |= MGA_FALLBACK_TEXTURE; + if ( MGA_DEBUG & DEBUG_VERBOSE_FALLBACK ) + fprintf( stderr, "FALLBACK: GL_DECAL RGBA texture, unit=%d\n", + unit ); #endif } else { @@ -613,6 +615,9 @@ static void mgaUpdateTextureEnvG400( GLcontext *ctx, int unit ) } else { mmesa->Fallback |= MGA_FALLBACK_TEXTURE; + if ( MGA_DEBUG & DEBUG_VERBOSE_FALLBACK ) + fprintf( stderr, "FALLBACK: GL_BLEND envcolor=0x%08x\n", + mmesa->envcolor ); /* Do singletexture GL_BLEND with 'all ones' env-color * by using both texture units. Multitexture gl_blend @@ -659,18 +664,25 @@ static void mgaUpdateTextureObject( GLcontext *ctx, int unit ) tObj = ctx->Texture.Unit[source].Current; if (enabled != TEXTURE0_2D) { - if (enabled) + if (enabled) { mmesa->Fallback |= MGA_FALLBACK_TEXTURE; + if ( MGA_DEBUG & DEBUG_VERBOSE_FALLBACK ) + fprintf( stderr, "FALLBACK: tex enable != 2D\n" ); + } return; } if ( !tObj || tObj != ctx->Texture.Unit[source].CurrentD[2] ) { mmesa->Fallback |= MGA_FALLBACK_TEXTURE; + if ( MGA_DEBUG & DEBUG_VERBOSE_FALLBACK ) + fprintf( stderr, "FALLBACK: tObj != 2D texture\n" ); return; } if (tObj->Image[tObj->BaseLevel]->Border > 0) { mmesa->Fallback |= MGA_FALLBACK_TEXTURE; + if ( MGA_DEBUG & DEBUG_VERBOSE_FALLBACK ) + fprintf( stderr, "FALLBACK: texture border\n" ); return; } @@ -681,6 +693,8 @@ static void mgaUpdateTextureObject( GLcontext *ctx, int unit ) mgaCreateTexObj( mmesa, tObj ); if ( !tObj->DriverData ) { mmesa->Fallback |= MGA_FALLBACK_TEXTURE; + if ( MGA_DEBUG & DEBUG_VERBOSE_FALLBACK ) + fprintf( stderr, "FALLBACK: could not create texture object\n" ); return; } } diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatex.h b/xc/lib/GL/mesa/src/drv/mga/mgatex.h index bd977f1e8..7180ef77d 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatex.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgatex.h @@ -1,30 +1,30 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatex.h,v 1.6 2001/04/10 16:07:51 dawes Exp $ */ /* - * GLX Hardware Device Driver for Matrox Millenium G200 - * Copyright (C) 1999 Wittawat Yamwong + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, 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: + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * - * John Carmack <johnc@idsoftware.com> - * Keith Whitwell <keithw@precisioninsight.com> + * Authors: + * Keith Whitwell <keithw@valinux.com> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatex.h,v 1.5 2001/01/08 01:07:19 martin Exp $ */ #ifndef MGATEX_INC #define MGATEX_INC @@ -47,7 +47,7 @@ void mgaConvertTexture( GLuint *dest, int texelBytes, void mgaUploadSubImageLocked( mgaContextPtr mmesa, mgaTextureObjectPtr t, - int level, + int level, int x, int y, int width, int height ); int mgaUploadTexImages( mgaContextPtr mmesa, mgaTextureObjectPtr t ); diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatexcnv.c b/xc/lib/GL/mesa/src/drv/mga/mgatexcnv.c index 4e5bf8607..aa26d181e 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatexcnv.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgatexcnv.c @@ -1,32 +1,31 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatexcnv.c,v 1.1 2000/09/24 13:51:08 alanh Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatexcnv.c,v 1.2 2001/04/10 16:07:51 dawes Exp $ */ /* - * GLX Hardware Device Driver for Matrox Millenium G200 - * Copyright (C) 1999 Wittawat Yamwong + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, 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: + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * - * original by Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de> - * 9/20/99 rewrite by John Carmack <johnc@idsoftware.com> + * Authors: + * Keith Whitwell <keithw@valinux.com> */ - #include <stdlib.h> #include <stdio.h> @@ -44,18 +43,18 @@ * for an 8x8 texture. This happens when we have to crutch the pitch * limits of the mga by uploading a block of texels as a single line. */ -void mgaConvertTexture( GLuint *destPtr, int texelBytes, +void mgaConvertTexture( GLuint *destPtr, int texelBytes, struct gl_texture_image *image, - int x, int y, int width, int height ) + int x, int y, int width, int height ) { register int i, j; GLubyte *src; int stride; - + if (0) fprintf(stderr, "texture image %p\n", image->Data); - - if (image->Data == 0) + + if (image->Data == 0) return; /* FIXME: g400 luminance_alpha internal format */ @@ -70,7 +69,7 @@ void mgaConvertTexture( GLuint *destPtr, int texelBytes, stride = (image->Width - width); for ( i = height ; i ; i-- ) { for ( j = width >> 2 ; j ; j-- ) { - + *destPtr++ = src[0] | ( src[1] << 8 ) | ( src[2] << 16 ) | ( src[3] << 24 ); src += 4; } @@ -88,8 +87,8 @@ void mgaConvertTexture( GLuint *destPtr, int texelBytes, stride = (image->Width - width) * 3; for ( i = height ; i ; i-- ) { for ( j = width >> 1 ; j ; j-- ) { - - *destPtr++ = MGAPACKCOLOR565(src[0],src[1],src[2]) | + + *destPtr++ = MGAPACKCOLOR565(src[0],src[1],src[2]) | ( MGAPACKCOLOR565(src[3],src[4],src[5]) << 16 ); src += 6; } @@ -101,8 +100,8 @@ void mgaConvertTexture( GLuint *destPtr, int texelBytes, stride = (image->Width - width) * 4; for ( i = height ; i ; i-- ) { for ( j = width >> 1 ; j ; j-- ) { - - *destPtr++ = MGAPACKCOLOR4444(src[0],src[1],src[2],src[3]) | + + *destPtr++ = MGAPACKCOLOR4444(src[0],src[1],src[2],src[3]) | ( MGAPACKCOLOR4444(src[4],src[5],src[6],src[7]) << 16 ); src += 8; } @@ -115,7 +114,7 @@ void mgaConvertTexture( GLuint *destPtr, int texelBytes, for ( i = height ; i ; i-- ) { for ( j = width >> 1 ; j ; j-- ) { /* FIXME: should probably use 555 texture to get true grey */ - *destPtr++ = MGAPACKCOLOR565(src[0],src[0],src[0]) | + *destPtr++ = MGAPACKCOLOR565(src[0],src[0],src[0]) | ( MGAPACKCOLOR565(src[1],src[1],src[1]) << 16 ); src += 2; } @@ -127,8 +126,8 @@ void mgaConvertTexture( GLuint *destPtr, int texelBytes, stride = (image->Width - width); for ( i = height ; i ; i-- ) { for ( j = width >> 1 ; j ; j-- ) { - - *destPtr++ = MGAPACKCOLOR4444(src[0],src[0],src[0],src[0]) | + + *destPtr++ = MGAPACKCOLOR4444(src[0],src[0],src[0],src[0]) | ( MGAPACKCOLOR4444(src[1],src[1],src[1],src[1]) << 16 ); src += 2; } @@ -140,8 +139,8 @@ void mgaConvertTexture( GLuint *destPtr, int texelBytes, stride = (image->Width - width); for ( i = height ; i ; i-- ) { for ( j = width >> 1 ; j ; j-- ) { - - *destPtr++ = MGAPACKCOLOR4444(255,255,255,src[0]) | + + *destPtr++ = MGAPACKCOLOR4444(255,255,255,src[0]) | ( MGAPACKCOLOR4444(255,255,255,src[1]) << 16 ); src += 2; } @@ -153,8 +152,8 @@ void mgaConvertTexture( GLuint *destPtr, int texelBytes, stride = (image->Width - width) * 2; for ( i = height ; i ; i-- ) { for ( j = width >> 1 ; j ; j-- ) { - - *destPtr++ = MGAPACKCOLOR4444(src[0],src[0],src[0],src[1]) | + + *destPtr++ = MGAPACKCOLOR4444(src[0],src[0],src[0],src[1]) | ( MGAPACKCOLOR4444(src[2],src[2],src[2],src[3]) << 16 ); src += 4; } @@ -172,7 +171,7 @@ void mgaConvertTexture( GLuint *destPtr, int texelBytes, stride = (image->Width - width) * 3; for ( i = height ; i ; i-- ) { for ( j = width ; j ; j-- ) { - + *destPtr++ = MGAPACKCOLOR8888(src[0],src[1],src[2], 255); src += 3; } @@ -184,7 +183,7 @@ void mgaConvertTexture( GLuint *destPtr, int texelBytes, stride = (image->Width - width) * 4; for ( i = height ; i ; i-- ) { for ( j = width ; j ; j-- ) { - + *destPtr++ = MGAPACKCOLOR8888(src[0],src[1],src[2],src[3]); src += 4; } @@ -196,7 +195,7 @@ void mgaConvertTexture( GLuint *destPtr, int texelBytes, stride = (image->Width - width); for ( i = height ; i ; i-- ) { for ( j = width ; j ; j-- ) { - + *destPtr++ = MGAPACKCOLOR8888(src[0],src[0],src[0], 255); src += 1; } @@ -208,7 +207,7 @@ void mgaConvertTexture( GLuint *destPtr, int texelBytes, stride = (image->Width - width); for ( i = height ; i ; i-- ) { for ( j = width ; j ; j-- ) { - + *destPtr++ = MGAPACKCOLOR8888(src[0],src[0],src[0],src[0]); src += 1; } @@ -220,7 +219,7 @@ void mgaConvertTexture( GLuint *destPtr, int texelBytes, stride = (image->Width - width); for ( i = height ; i ; i-- ) { for ( j = width ; j ; j-- ) { - + *destPtr++ = MGAPACKCOLOR8888(255,255,255,src[0]); src += 1; } @@ -232,7 +231,7 @@ void mgaConvertTexture( GLuint *destPtr, int texelBytes, stride = (image->Width - width) * 2; for ( i = height ; i ; i-- ) { for ( j = width ; j ; j-- ) { - + *destPtr++ = MGAPACKCOLOR8888(src[0],src[0], src[0],src[1]); src += 2; @@ -252,6 +251,6 @@ void mgaConvertTexture( GLuint *destPtr, int texelBytes, format_error: - fprintf(stderr, "Unsupported texelBytes %i, image->Format %i\n", + fprintf(stderr, "Unsupported texelBytes %i, image->Format %i\n", (int)texelBytes, (int)image->Format ); } diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c b/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c index 04f1cb10d..b421e284d 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c @@ -1,4 +1,30 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatexmem.c,v 1.3 2001/03/21 16:14:22 dawes Exp $ */ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keithw@valinux.com> + */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatexmem.c,v 1.4 2001/04/10 16:07:51 dawes Exp $ */ #include <stdlib.h> #include <stdio.h> diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatris.c b/xc/lib/GL/mesa/src/drv/mga/mgatris.c index cd10daddd..cd9da5a0e 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatris.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgatris.c @@ -1,29 +1,30 @@ /* - * GLX Hardware Device Driver for Matrox Millenium G200 - * Copyright (C) 1999 Wittawat Yamwong + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, 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: + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * - * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de> + * Authors: + * Keith Whitwell <keithw@valinux.com> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatris.c,v 1.7 2001/03/21 16:14:22 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatris.c,v 1.8 2001/04/10 16:07:51 dawes Exp $ */ #include <stdio.h> #include <math.h> @@ -53,9 +54,9 @@ -static triangle_func tri_tab[0x10]; -static quad_func quad_tab[0x10]; -static line_func line_tab[0x10]; +static triangle_func tri_tab[0x10]; +static quad_func quad_tab[0x10]; +static line_func line_tab[0x10]; static points_func points_tab[0x10]; #define IND (0) @@ -132,9 +133,9 @@ void mgaDDChooseRenderState(GLcontext *ctx) if (flags & ANY_RASTER_FLAGS) { if (flags & DD_FLATSHADE) index |= MGA_FLAT_BIT; if (flags & DD_TRI_LIGHT_TWOSIDE) index |= MGA_TWOSIDE_BIT; - if (flags & DD_TRI_OFFSET) index |= MGA_OFFSET_BIT; + if (flags & DD_TRI_OFFSET) index |= MGA_OFFSET_BIT; } - + mmesa->PointsFunc = points_tab[index]; mmesa->LineFunc = line_tab[index]; mmesa->TriangleFunc = tri_tab[index]; @@ -149,7 +150,7 @@ void mgaDDChooseRenderState(GLcontext *ctx) mmesa->PointsFunc = 0; mmesa->IndirectTriangles |= DD_POINT_SW_RASTERIZE; } - + if (flags & LINE_FALLBACK) { mmesa->renderindex |= MGA_FALLBACK_BIT; mmesa->LineFunc = 0; diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatris.h b/xc/lib/GL/mesa/src/drv/mga/mgatris.h index 1015c6fdd..5a16490e6 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatris.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgatris.h @@ -1,32 +1,33 @@ /* - * GLX Hardware Device Driver for Matrox Millenium G200 - * Copyright (C) 1999 Wittawat Yamwong + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, 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: + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * - * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de> + * Authors: + * Keith Whitwell <keithw@valinux.com> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatris.h,v 1.7 2001/03/21 16:14:22 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatris.h,v 1.8 2001/04/10 16:07:51 dawes Exp $ */ -#ifndef MGATIS_INC -#define MGATIS_INC +#ifndef MGATRIS_INC +#define MGATRIS_INC #include "types.h" #include "mgaioctl.h" @@ -36,13 +37,13 @@ extern void mgaDDTrifuncInit( void ); #define MGA_FLAT_BIT 0x1 -#define MGA_OFFSET_BIT 0x2 -#define MGA_TWOSIDE_BIT 0x4 +#define MGA_OFFSET_BIT 0x2 +#define MGA_TWOSIDE_BIT 0x4 #define MGA_FALLBACK_BIT 0x8 static __inline void mga_draw_triangle( mgaContextPtr mmesa, - mgaVertex *v0, - mgaVertex *v1, + mgaVertex *v0, + mgaVertex *v1, mgaVertex *v2 ) { GLuint vertsize = mmesa->vertsize; @@ -69,15 +70,15 @@ static __inline void mga_draw_triangle( mgaContextPtr mmesa, : "memory" ); #else { - for (j = 0 ; j < vertsize ; j++) + for (j = 0 ; j < vertsize ; j++) wv[j] = v0->ui[j]; wv += vertsize; - for (j = 0 ; j < vertsize ; j++) + for (j = 0 ; j < vertsize ; j++) wv[j] = v1->ui[j]; wv += vertsize; - for (j = 0 ; j < vertsize ; j++) + for (j = 0 ; j < vertsize ; j++) wv[j] = v2->ui[j]; } #endif @@ -95,43 +96,43 @@ static __inline void mga_draw_point( mgaContextPtr mmesa, *(float *)&wv[0] = x - sz; *(float *)&wv[1] = y - sz; - for (j = 2 ; j < vertsize ; j++) + for (j = 2 ; j < vertsize ; j++) wv[j] = tmp->ui[j]; wv += vertsize; *(float *)&wv[0] = x + sz; *(float *)&wv[1] = y - sz; - for (j = 2 ; j < vertsize ; j++) + for (j = 2 ; j < vertsize ; j++) wv[j] = tmp->ui[j]; wv += vertsize; *(float *)&wv[0] = x + sz; *(float *)&wv[1] = y + sz; - for (j = 2 ; j < vertsize ; j++) + for (j = 2 ; j < vertsize ; j++) wv[j] = tmp->ui[j]; wv += vertsize; *(float *)&wv[0] = x + sz; *(float *)&wv[1] = y + sz; - for (j = 2 ; j < vertsize ; j++) + for (j = 2 ; j < vertsize ; j++) wv[j] = tmp->ui[j]; wv += vertsize; *(float *)&wv[0] = x - sz; *(float *)&wv[1] = y + sz; - for (j = 2 ; j < vertsize ; j++) + for (j = 2 ; j < vertsize ; j++) wv[j] = tmp->ui[j]; wv += vertsize; *(float *)&wv[0] = x - sz; *(float *)&wv[1] = y - sz; - for (j = 2 ; j < vertsize ; j++) + for (j = 2 ; j < vertsize ; j++) wv[j] = tmp->ui[j]; } static __inline void mga_draw_line( mgaContextPtr mmesa, - const mgaVertex *tmp0, + const mgaVertex *tmp0, const mgaVertex *tmp1, float width ) { @@ -178,37 +179,37 @@ static __inline void mga_draw_line( mgaContextPtr mmesa, *(float *)&wv[0] = x0 - ix; *(float *)&wv[1] = y0 - iy; - for (j = 2 ; j < vertsize ; j++) + for (j = 2 ; j < vertsize ; j++) wv[j] = tmp0->ui[j]; wv += vertsize; *(float *)&wv[0] = x1 + ix; *(float *)&wv[1] = y1 + iy; - for (j = 2 ; j < vertsize ; j++) + for (j = 2 ; j < vertsize ; j++) wv[j] = tmp1->ui[j]; wv += vertsize; *(float *)&wv[0] = x0 + ix; *(float *)&wv[1] = y0 + iy; - for (j = 2 ; j < vertsize ; j++) + for (j = 2 ; j < vertsize ; j++) wv[j] = tmp0->ui[j]; wv += vertsize; - + *(float *)&wv[0] = x0 - ix; *(float *)&wv[1] = y0 - iy; - for (j = 2 ; j < vertsize ; j++) + for (j = 2 ; j < vertsize ; j++) wv[j] = tmp0->ui[j]; wv += vertsize; *(float *)&wv[0] = x1 - ix; *(float *)&wv[1] = y1 - iy; - for (j = 2 ; j < vertsize ; j++) + for (j = 2 ; j < vertsize ; j++) wv[j] = tmp1->ui[j]; wv += vertsize; *(float *)&wv[0] = x1 + ix; *(float *)&wv[1] = y1 + iy; - for (j = 2 ; j < vertsize ; j++) + for (j = 2 ; j < vertsize ; j++) wv[j] = tmp1->ui[j]; wv += vertsize; } diff --git a/xc/lib/GL/mesa/src/drv/mga/mgavb.c b/xc/lib/GL/mesa/src/drv/mga/mgavb.c index d8f597fcf..90020f178 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgavb.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgavb.c @@ -1,30 +1,31 @@ /* - * GLX Hardware Device Driver for Matrox Millenium G200 - * Copyright (C) 1999 Wittawat Yamwong + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, 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: + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * - * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de> + * Authors: + * Keith Whitwell <keithw@valinux.com> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgavb.c,v 1.9 2001/03/21 16:14:22 dawes Exp $ */ - +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgavb.c,v 1.10 2001/04/10 16:07:51 dawes Exp $ */ + #include "mgacontext.h" #include "mgavb.h" #include "mga_xmesa.h" @@ -67,7 +68,7 @@ /* The v code we have doesn't seem to support projective texturing * in the multitexture case. (Would require another 1/w value for the - * second set of texcoords). This may be a problem for the g400. + * second set of texcoords). This may be a problem for the g400. */ #define TEX0_4 \ if (VB->TexCoordPtr[0]->size == 4) { \ @@ -88,7 +89,7 @@ v->v.rhw = win[3]; \ v->v.z = depth_scale * win[2]; \ v->v.x = win[0] + xoffset; \ - v->v.y = - win[1] + yoffset; + v->v.y = - win[1] + yoffset; #define NOP @@ -195,7 +196,7 @@ void mgaDDSetupInit( void ) for (i = 0 ; i < 0x80 ; i++) setup_func[i] = rs_invalid; - + /* Functions to build vert's from scratch */ setup_func[MGA_WIN_BIT|MGA_TEX0_BIT] = rs_wt0; setup_func[MGA_WIN_BIT|MGA_TEX0_BIT|MGA_TEX1_BIT] = rs_wt0t1; @@ -241,7 +242,7 @@ void mgaPrintSetupFlags(char *msg, GLuint flags ) fprintf(stderr, "%s: %d %s%s%s%s%s%s%s\n", msg, (int)flags, - (flags & MGA_WIN_BIT) ? " xyzw," : "", + (flags & MGA_WIN_BIT) ? " xyzw," : "", (flags & MGA_RGBA_BIT) ? " rgba," : "", (flags & MGA_SPEC_BIT) ? " spec," : "", (flags & MGA_FOG_BIT) ? " fog," : "", @@ -273,44 +274,44 @@ void mgaChooseRasterSetupFunc(GLcontext *ctx) funcindex &= ~MGA_RGBA_BIT; */ if (ctx->Texture.Unit[0].EnvMode == GL_BLEND && - mmesa->envcolor) + mmesa->envcolor) { mmesa->multitex = 1; mmesa->vertsize = 10; mmesa->tmu_source[1] = 0; funcindex |= MGA_TEX1_BIT; - } + } funcindex |= MGA_TEX0_BIT; } - if (ctx->Texture.ReallyEnabled & 0xf0) { + if (ctx->Texture.ReallyEnabled & 0xf0) { if (ctx->Texture.ReallyEnabled & 0xf) { mmesa->multitex = 1; mmesa->vertsize = 10; mmesa->blend_flags |= MGA_BLEND_MULTITEX; - funcindex |= MGA_TEX1_BIT; + funcindex |= MGA_TEX1_BIT; } else { - /* Just a funny way of doing single texturing + /* Just a funny way of doing single texturing */ mmesa->tmu_source[0] = 1; mmesa->tex_dest[1] = MGA_TEX0_BIT; if (ctx->Texture.Unit[0].EnvMode == GL_BLEND && - mmesa->envcolor) + mmesa->envcolor) { mmesa->multitex = 1; mmesa->vertsize = 10; mmesa->tmu_source[1] = 1; funcindex |= MGA_TEX1_BIT; - } + } funcindex |= MGA_TEX0_BIT; } } if (multi != mmesa->multitex) - mmesa->new_state |= MGA_NEW_WARP; + mmesa->new_state |= MGA_NEW_WARP; /* Not really a good place to do this - need to make the mga state @@ -328,7 +329,7 @@ void mgaChooseRasterSetupFunc(GLcontext *ctx) funcindex |= MGA_FOG_BIT; if (0) - mgaPrintSetupFlags("xsmesa: full setup function", funcindex); + mgaPrintSetupFlags("xsmesa: full setup function", funcindex); mmesa->dirty |= MGA_UPLOAD_PIPE; mmesa->setupindex = funcindex; @@ -352,7 +353,7 @@ void mgaDDCheckPartialRasterSetup( GLcontext *ctx, struct gl_pipeline_stage *d ) if ((ctx->Array.Summary & VERT_OBJ_ANY) == 0) return; - if (ctx->IndirectTriangles) + if (ctx->IndirectTriangles) return; mmesa->setupdone = tmp; @@ -381,7 +382,7 @@ void mgaDDPartialRasterSetup( struct vertex_buffer *VB ) if (new & VERT_RGBA) ind |= MGA_RGBA_BIT | MGA_SPEC_BIT; - if (new & VERT_TEX0_ANY) + if (new & VERT_TEX0_ANY) ind |= MGA_TEX0_BIT; if (new & VERT_TEX1_ANY) @@ -397,8 +398,8 @@ void mgaDDPartialRasterSetup( struct vertex_buffer *VB ) if (0) mgaPrintSetupFlags("xsmesa: partial setup function", ind); - if (ind) - setup_func[ind&~MGA_ALPHA_BIT]( VB, VB->Start, VB->Count ); + if (ind) + setup_func[ind&~MGA_ALPHA_BIT]( VB, VB->Start, VB->Count ); } @@ -411,7 +412,7 @@ void mgaDDDoRasterSetup( struct vertex_buffer *VB ) */ /* REFRESH_DRAWABLE_INFO( mmesa ); */ - if (VB->Type == VB_CVA_PRECALC) + if (VB->Type == VB_CVA_PRECALC) mgaDDPartialRasterSetup( VB ); else if (ctx->Driver.RasterSetup) ctx->Driver.RasterSetup( VB, VB->CopyStart, VB->Count ); @@ -433,19 +434,19 @@ void mgaDDResizeVB( struct vertex_buffer *VB, GLuint size ) FREE( mvb->vert_store ); mvb->vert_store = MALLOC( sizeof(mgaVertex) * mvb->size + 31); - if (!mvb->vert_store) + if (!mvb->vert_store) FatalError("mga-glx: out of memory !\n"); mvb->verts = (mgaVertexPtr)(((unsigned long)mvb->vert_store + 31) & ~31); gl_vector1ui_free( &mvb->clipped_elements ); - gl_vector1ui_alloc( &mvb->clipped_elements, VEC_WRITABLE, mvb->size, 32 ); - if (!mvb->clipped_elements.start) + gl_vector1ui_alloc( &mvb->clipped_elements, VEC_WRITABLE, mvb->size, 32 ); + if (!mvb->clipped_elements.start) FatalError("mga-glx: out of memory !\n"); ALIGN_FREE( VB->ClipMask ); VB->ClipMask = (GLubyte *)ALIGN_MALLOC(sizeof(GLubyte) * mvb->size, 32); - if (!VB->ClipMask) + if (!VB->ClipMask) FatalError("mga-glx: out of memory !\n"); if (VB->Type == VB_IMMEDIATE) { @@ -471,25 +472,25 @@ void mgaDDRegisterVB( struct vertex_buffer *VB ) */ mvb->size = VB->Size * 5; mvb->vert_store = MALLOC( sizeof(mgaVertex) * mvb->size + 31); - if (!mvb->vert_store) + if (!mvb->vert_store) FatalError("mga-glx: out of memory !\n"); - + mvb->verts = (mgaVertexPtr)(((unsigned long)mvb->vert_store + 31) & ~31); gl_vector1ui_alloc( &mvb->clipped_elements, VEC_WRITABLE, mvb->size, 32 ); - if (!mvb->clipped_elements.start) + if (!mvb->clipped_elements.start) FatalError("mga-glx: out of memory !\n"); ALIGN_FREE( VB->ClipMask ); VB->ClipMask = (GLubyte *)ALIGN_MALLOC(sizeof(GLubyte) * mvb->size, 32); - if (!VB->ClipMask) + if (!VB->ClipMask) FatalError("mga-glx: out of memory !\n"); mvb->primitive = (GLuint *)MALLOC( sizeof(GLuint) * mvb->size ); mvb->next_primitive = (GLuint *)MALLOC( sizeof(GLuint) * mvb->size ); if (!mvb->primitive || !mvb->next_primitive) FatalError("mga-glx: out of memory!"); - + VB->driver_data = mvb; } @@ -497,7 +498,7 @@ void mgaDDRegisterVB( struct vertex_buffer *VB ) void mgaDDUnregisterVB( struct vertex_buffer *VB ) { mgaVertexBufferPtr mvb = MGA_DRIVER_DATA(VB); - + if (mvb) { if (mvb->vert_store) FREE(mvb->vert_store); if (mvb->primitive) FREE(mvb->primitive); @@ -505,7 +506,5 @@ void mgaDDUnregisterVB( struct vertex_buffer *VB ) gl_vector1ui_free( &mvb->clipped_elements ); FREE(mvb); VB->driver_data = 0; - } + } } - - diff --git a/xc/lib/GL/mesa/src/drv/mga/mgavb.h b/xc/lib/GL/mesa/src/drv/mga/mgavb.h index c51fd0744..399d946ec 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgavb.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgavb.h @@ -1,29 +1,30 @@ +/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgavb.h,v 1.6 2001/04/10 16:07:51 dawes Exp $ */ /* - * GLX Hardware Device Driver for Matrox Millenium G200 - * Copyright (C) 1999 Wittawat Yamwong + * Copyright 2000-2001 VA Linux Systems, Inc. + * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, 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: + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * - * Wittawat Yamwong <Wittawat.Yamwong@stud.uni-hannover.de> + * Authors: + * Keith Whitwell <keithw@valinux.com> */ -/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgavb.h,v 1.5 2000/09/24 13:51:09 alanh Exp $ */ #ifndef MGAVB_INC #define MGAVB_INC @@ -34,7 +35,7 @@ /* common datatypes for the mga warp engines */ -/* +/* * color type for the vertex data * we probably want to use an internal datatype here? */ @@ -64,7 +65,7 @@ typedef struct mga_warp_vertex_t { /* The fastpath code still expects a 16-float stride vertex. */ union mga_vertex_t { - mga_warp_vertex v; + mga_warp_vertex v; float f[16]; GLuint ui[16]; }; @@ -85,7 +86,7 @@ struct mga_vertex_buffer_t { GLuint *elt_buf; GLuint vert_phys_start; }; - + typedef struct mga_vertex_buffer_t *mgaVertexBufferPtr; #define MGA_CONTEXT(ctx) ((mgaContextPtr)((ctx)->DriverCtx)) @@ -106,7 +107,7 @@ extern void mgaChooseRasterSetupFunc(GLcontext *ctx); extern void mgaPrintSetupFlags(char *msg, GLuint flags ); extern void mgaDDDoRasterSetup( struct vertex_buffer *VB ); extern void mgaDDPartialRasterSetup( struct vertex_buffer *VB ); -extern void mgaDDCheckPartialRasterSetup( GLcontext *ctx, +extern void mgaDDCheckPartialRasterSetup( GLcontext *ctx, struct gl_pipeline_stage *d ); diff --git a/xc/lib/GL/mesa/src/drv/r128/Imakefile.inc b/xc/lib/GL/mesa/src/drv/r128/Imakefile.inc index 826a27e44..ebf4fc39f 100644 --- a/xc/lib/GL/mesa/src/drv/r128/Imakefile.inc +++ b/xc/lib/GL/mesa/src/drv/r128/Imakefile.inc @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r128/Imakefile.inc,v 1.1 2001/03/23 19:18:41 dawes Exp $ +XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r128/Imakefile.inc,v 1.2 2001/04/10 17:53:07 dawes Exp $ #ifndef MesaDrvSrcDir #define MesaDrvSrcDir $(GLXLIBSRC)/mesa/src/drv @@ -16,7 +16,7 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL #endif #if BuildXF86DRI - DRI_DEFINES = GlxDefines -DDRIVERTS + DRI_DEFINES = GlxDefines -DDRIVERTS -DX_BYTE_ORDER=ByteOrder DRI_INCLUDES = -I$(GLXLIBSRC)/dri -I$(GLXLIBSRC)/glx \ -I$(INCLUDESRC) -I$(INCLUDESRC)/GL \ -I$(GLXLIBSRC)/mesa/dri \ diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_context.h b/xc/lib/GL/mesa/src/drv/r128/r128_context.h index 462b8b812..800cc1754 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_context.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_context.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.h,v 1.6 2001/03/21 16:14:23 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.h,v 1.8 2001/04/10 17:53:07 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -255,6 +255,24 @@ extern r128ContextPtr r128MakeCurrent( r128ContextPtr oldCtx, r128ContextPtr newCtx, __DRIdrawablePrivate *dPriv ); +/* ================================================================ + * Byte ordering + */ +#include "X11/Xarch.h" + +#if X_BYTE_ORDER == X_LITTLE_ENDIAN +#define LE32_OUT( x, y ) do { x = y; } while (0) +#define LE32_OUT_FLOAT( x, y ) do { *(GLfloat *)&(x) = y; } while (0) +#else +#include <byteswap.h> +#define LE32_OUT( x, y ) do { x = bswap_32( y ); } while (0) +#define LE32_OUT_FLOAT( x, y ) \ +do { \ + GLuint __tmp; \ + *(GLfloat *)&__tmp = y; \ + x = bswap_32( __tmp ); \ +} while (0) +#endif /* ================================================================ * Debugging: diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_dd.c b/xc/lib/GL/mesa/src/drv/r128/r128_dd.c index af5fb66ff..fd6223ff5 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_dd.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_dd.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_dd.c,v 1.11 2001/03/25 05:32:00 tsi Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_dd.c,v 1.12 2001/04/10 16:07:52 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -45,7 +45,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "X86/common_x86_asm.h" #endif -#define R128_DATE "20010130" +#define R128_DATE "20010405" /* Return the width and height of the current color buffer. @@ -84,7 +84,7 @@ static const GLubyte *r128DDGetString( GLcontext *ctx, GLenum name ) strncat( buffer, " M3", 3 ); } - /* Append any AGP-specific information. + /* Append any AGP/PCI-specific information. */ switch ( rmesa->r128Screen->AGPMode ) { case 1: diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c b/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c index 76b87775d..09dbb390d 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c,v 1.5 2001/04/01 14:00:00 tsi Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c,v 1.6 2001/04/10 16:07:52 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -308,7 +308,19 @@ static int r128WaitForFrameCompletion( r128ContextPtr rmesa ) int wait = 0; while ( 1 ) { +#if defined(__alpha__) + /* necessary to preserve the Alpha paradigm */ + /* NOTE: this will not work on SPARSE machines */ + mem_barrier(); + frame = *(volatile CARD32 *)(void *)(R128MMIO + R128_LAST_FRAME_REG); +#else frame = INREG( R128_LAST_FRAME_REG ); +#endif + + if ( 0 ) + fprintf( stderr, " last=0x%08x frame=0x%08x\n", + rmesa->sarea->last_frame, frame ); + if ( rmesa->sarea->last_frame - frame <= R128_MAX_OUTSTANDING ) { break; } @@ -327,7 +339,7 @@ static int r128WaitForFrameCompletion( r128ContextPtr rmesa ) */ void r128SwapBuffers( r128ContextPtr rmesa ) { - GLint nbox = rmesa->numClipRects; + GLint nbox; GLint i; GLint ret; @@ -342,6 +354,8 @@ void r128SwapBuffers( r128ContextPtr rmesa ) LOCK_HARDWARE( rmesa ); + nbox = rmesa->numClipRects; /* must be in locked region */ + /* Throttle the frame rate -- only allow one pending swap buffers * request at a time. */ 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 ee3ba607d..4e8601c0b 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.8 2001/03/21 16:14:24 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.c,v 1.9 2001/04/10 16:07:52 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -30,6 +30,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Authors: * Gareth Hughes <gareth@valinux.com> * Kevin E. Martin <martin@valinux.com> + * Michel Dänzer <michdaen@iiic.ethz.ch> * */ @@ -572,8 +573,8 @@ static void r128ConvertTexture16bpp( CARD32 *dst, for ( i = 0 ; i < height ; i++ ) { src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 4; for ( j = width >> 1 ; j ; j-- ) { - *dst++ = ((R128PACKCOLOR4444( src[0], src[1], src[2], src[3] )) | - (R128PACKCOLOR4444( src[4], src[5], src[6], src[7] ) << 16)); + *dst++ = R128PACKCOLORS4444( src[0], src[1], src[2], src[3], + src[4], src[5], src[6], src[7] ); src += 8; } } @@ -583,8 +584,8 @@ static void r128ConvertTexture16bpp( CARD32 *dst, for ( i = 0 ; i < height ; i++ ) { src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 3; for ( j = width >> 1 ; j ; j-- ) { - *dst++ = ((R128PACKCOLOR565( src[0], src[1], src[2] )) | - (R128PACKCOLOR565( src[3], src[4], src[5] ) << 16)); + *dst++ = R128PACKCOLORS565( src[0], src[1], src[2], + src[3], src[4], src[5] ); src += 6; } } @@ -594,8 +595,8 @@ static void r128ConvertTexture16bpp( CARD32 *dst, for ( i = 0 ; i < height ; i++ ) { src = (CARD8 *)image->Data + ((y + i) * pitch + x); for ( j = width >> 1 ; j ; j-- ) { - *dst++ = ((R128PACKCOLOR4444( 0xff, 0xff, 0xff, src[0] )) | - (R128PACKCOLOR4444( 0xff, 0xff, 0xff, src[1] ) << 16)); + *dst++ = R128PACKCOLORS4444( 0xff, 0xff, 0xff, src[0], + 0xff, 0xff, 0xff, src[1] ); src += 2; } } @@ -605,8 +606,8 @@ static void r128ConvertTexture16bpp( CARD32 *dst, for ( i = 0 ; i < height ; i++ ) { src = (CARD8 *)image->Data + ((y + i) * pitch + x) * 2; for ( j = width >> 1 ; j ; j-- ) { - *dst++ = ((R128PACKCOLOR4444( src[0], src[0], src[0], src[1] )) | - (R128PACKCOLOR4444( src[2], src[2], src[2], src[3] ) << 16)); + *dst++ = R128PACKCOLORS4444( src[0], src[0], src[0], src[1], + src[2], src[2], src[2], src[3] ); src += 4; } } @@ -877,7 +878,8 @@ int r128UploadTexImages( r128ContextPtr rmesa, r128TexObjPtr t ) t->memBlock = mmAllocMem( rmesa->texHeap[heap], t->totalSize, 12, 0 ); /* Try AGP before kicking anything out of local mem */ - if ( !t->memBlock && heap == R128_CARD_HEAP ) { + if ( !rmesa->r128Screen->IsPCI && + !t->memBlock && heap == R128_CARD_HEAP ) { t->memBlock = mmAllocMem( rmesa->texHeap[R128_AGP_HEAP], t->totalSize, 12, 0 ); diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_tex.h b/xc/lib/GL/mesa/src/drv/r128/r128_tex.h index e1f67a56d..4e8822947 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_tex.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_tex.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.h,v 1.4 2001/01/08 01:07:23 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.h,v 1.6 2001/04/10 17:53:07 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -74,6 +74,24 @@ extern void r128DDInitTextureFuncs( GLcontext *ctx ); #define R128PACKCOLOR4444( r, g, b, a ) \ ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4)) +#include "X11/Xarch.h" +#if X_BYTE_ORDER == X_LITTLE_ENDIAN +#define R128PACKCOLORS565( r0, g0, b0, r1, g1, b1 ) \ + ((R128PACKCOLOR565( r0, g0, b0 )) | \ + (R128PACKCOLOR565( r1, g1, b1 ) << 16)) +#define R128PACKCOLORS4444( r0, g0, b0, a0, r1, g1, b1, a1 ) \ + ((R128PACKCOLOR4444( r0, g0, b0, a0 )) | \ + (R128PACKCOLOR4444( r1, g1, b1, a1 ) << 16)) +#else +#define R128PACKCOLORS565( r0, g0, b0, r1, g1, b1 ) \ + ((R128PACKCOLOR565( r1, g1, b1 )) | \ + (R128PACKCOLOR565( r0, g0, b0 ) << 16)) +#define R128PACKCOLORS4444( r0, g0, b0, a0, r1, g1, b1, a1 ) \ + ((R128PACKCOLOR4444( r1, g1, b1, a1 )) | \ + (R128PACKCOLOR4444( r0, g0, b0, a0 ) << 16)) + +#endif + static __inline__ CARD32 r128PackColor( GLuint cpp, GLubyte r, GLubyte g, GLubyte b, GLubyte a ) diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_tris.c b/xc/lib/GL/mesa/src/drv/r128/r128_tris.c index 4d83e27e0..261142d75 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_tris.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_tris.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tris.c,v 1.4 2001/01/08 01:07:24 martin Exp $ */ /* -*- c-basic-offset: 3 -*- */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tris.c,v 1.6 2001/04/10 17:53:07 dawes Exp $ */ /* -*- c-basic-offset: 3 -*- */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -30,6 +30,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Authors: * Gareth Hughes <gareth@valinux.com> * Kevin E. Martin <martin@valinux.com> + * Michel Dänzer <michdaen@iiic.ethz.ch> * */ @@ -49,6 +50,7 @@ static struct { quad_func quad; } rast_tab[R128_MAX_TRIFUNC]; +#if X_BYTE_ORDER == X_LITTLE_ENDIAN #define R128_COLOR( to, from ) \ do { \ (to)[0] = (from)[2]; \ @@ -56,6 +58,15 @@ do { \ (to)[2] = (from)[0]; \ (to)[3] = (from)[3]; \ } while (0) +#else +#define R128_COLOR( to, from ) \ +do { \ + (to)[0] = (from)[3]; \ + (to)[1] = (from)[0]; \ + (to)[2] = (from)[1]; \ + (to)[3] = (from)[2]; \ +} while (0) +#endif static void r128_null_quad( GLcontext *ctx, GLuint v0, diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_tris.h b/xc/lib/GL/mesa/src/drv/r128/r128_tris.h index 108c85075..a279af547 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_tris.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_tris.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tris.h,v 1.5 2001/03/21 16:14:24 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tris.h,v 1.6 2001/04/10 16:07:53 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -56,7 +56,7 @@ static __inline void r128_draw_triangle( r128ContextPtr rmesa, r128VertexPtr v1, r128VertexPtr v2 ) { - int vertsize = rmesa->vertsize; + GLuint vertsize = rmesa->vertsize; CARD32 *vb = r128AllocVerticesInline( rmesa, 3 ); int j; @@ -80,15 +80,15 @@ static __inline void r128_draw_triangle( r128ContextPtr rmesa, : "memory" ); #else for ( j = 0 ; j < vertsize ; j++ ) - vb[j] = v0->ui[j]; + LE32_OUT( vb[j], v0->ui[j] ); vb += vertsize; for ( j = 0 ; j < vertsize ; j++ ) - vb[j] = v1->ui[j]; + LE32_OUT( vb[j], v1->ui[j] ); vb += vertsize; for ( j = 0 ; j < vertsize ; j++ ) - vb[j] = v2->ui[j]; + LE32_OUT( vb[j], v2->ui[j] ); #endif } @@ -98,7 +98,7 @@ static __inline void r128_draw_quad( r128ContextPtr rmesa, r128VertexPtr v2, r128VertexPtr v3 ) { - int vertsize = rmesa->vertsize; + GLuint vertsize = rmesa->vertsize; CARD32 *vb = r128AllocVerticesInline( rmesa, 6 ); int j; @@ -134,37 +134,37 @@ static __inline void r128_draw_quad( r128ContextPtr rmesa, : "memory" ); #else for ( j = 0 ; j < vertsize ; j++ ) - vb[j] = v0->ui[j]; + LE32_OUT( vb[j], v0->ui[j] ); vb += vertsize; for ( j = 0 ; j < vertsize ; j++ ) - vb[j] = v1->ui[j]; + LE32_OUT( vb[j], v1->ui[j] ); vb += vertsize; for ( j = 0 ; j < vertsize ; j++ ) - vb[j] = v3->ui[j]; + LE32_OUT( vb[j], v3->ui[j] ); vb += vertsize; for ( j = 0 ; j < vertsize ; j++ ) - vb[j] = v1->ui[j]; + LE32_OUT( vb[j], v1->ui[j] ); vb += vertsize; for ( j = 0 ; j < vertsize ; j++ ) - vb[j] = v2->ui[j]; + LE32_OUT( vb[j], v2->ui[j] ); vb += vertsize; for ( j = 0 ; j < vertsize ; j++ ) - vb[j] = v3->ui[j]; + LE32_OUT( vb[j], v3->ui[j] ); #endif } static __inline void r128_draw_line( r128ContextPtr rmesa, r128VertexPtr tmp0, r128VertexPtr tmp1, - float width ) + GLfloat width ) { #if 1 - int vertsize = rmesa->vertsize; + GLuint vertsize = rmesa->vertsize; CARD32 *vb = r128AllocVerticesInline( rmesa, 6 ); GLfloat hw, dx, dy, ix, iy; GLuint j; @@ -204,40 +204,40 @@ static __inline void r128_draw_line( r128ContextPtr rmesa, x1 += 0.5F; } - *(float *)&vb[0] = x0 - ix; - *(float *)&vb[1] = y0 - iy; + LE32_OUT_FLOAT( vb[0], x0 - ix ); + LE32_OUT_FLOAT( vb[1], y0 - iy ); for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp0->ui[j]; + LE32_OUT( vb[j], tmp0->ui[j] ); vb += vertsize; - *(float *)&vb[0] = x1 + ix; - *(float *)&vb[1] = y1 + iy; + LE32_OUT_FLOAT( vb[0], x1 + ix ); + LE32_OUT_FLOAT( vb[1], y1 + iy ); for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp1->ui[j]; + LE32_OUT( vb[j], tmp1->ui[j] ); vb += vertsize; - *(float *)&vb[0] = x0 + ix; - *(float *)&vb[1] = y0 + iy; + LE32_OUT_FLOAT( vb[0], x0 + ix ); + LE32_OUT_FLOAT( vb[1], y0 + iy ); for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp0->ui[j]; + LE32_OUT( vb[j], tmp0->ui[j] ); vb += vertsize; - *(float *)&vb[0] = x0 - ix; - *(float *)&vb[1] = y0 - iy; + LE32_OUT_FLOAT( vb[0], x0 - ix ); + LE32_OUT_FLOAT( vb[1], y0 - iy ); for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp0->ui[j]; + LE32_OUT( vb[j], tmp0->ui[j] ); vb += vertsize; - *(float *)&vb[0] = x1 - ix; - *(float *)&vb[1] = y1 - iy; + LE32_OUT_FLOAT( vb[0], x1 - ix ); + LE32_OUT_FLOAT( vb[1], y1 - iy ); for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp1->ui[j]; + LE32_OUT( vb[j], tmp1->ui[j] ); vb += vertsize; - *(float *)&vb[0] = x1 + ix; - *(float *)&vb[1] = y1 + iy; + LE32_OUT_FLOAT( vb[0], x1 + ix ); + LE32_OUT_FLOAT( vb[1], y1 + iy ); for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp1->ui[j]; + LE32_OUT( vb[j], tmp1->ui[j] ); #else @@ -271,49 +271,50 @@ static __inline void r128_draw_line( r128ContextPtr rmesa, } static __inline void r128_draw_point( r128ContextPtr rmesa, - r128VertexPtr tmp, float sz ) + r128VertexPtr tmp, GLfloat sz ) { #if 1 - int vertsize = rmesa->vertsize; + GLuint vertsize = rmesa->vertsize; CARD32 *vb = r128AllocVerticesInline( rmesa, 6 ); int j; const float x = tmp->v.x + PNT_X_OFFSET; const float y = tmp->v.y + PNT_Y_OFFSET; - *(float *)&vb[0] = x - sz; - *(float *)&vb[1] = y - sz; + LE32_OUT_FLOAT( vb[0], x - sz ); + LE32_OUT_FLOAT( vb[1], y - sz ); for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp->ui[j]; + LE32_OUT( vb[j], tmp->ui[j] ); vb += vertsize; - *(float *)&vb[0] = x + sz; - *(float *)&vb[1] = y - sz; + LE32_OUT_FLOAT( vb[0], x + sz ); + LE32_OUT_FLOAT( vb[1], y - sz ); for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp->ui[j]; + LE32_OUT( vb[j], tmp->ui[j] ); vb += vertsize; - *(float *)&vb[0] = x + sz; - *(float *)&vb[1] = y + sz; + LE32_OUT_FLOAT( vb[0], x + sz ); + LE32_OUT_FLOAT( vb[1], y + sz ); for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp->ui[j]; + LE32_OUT( vb[j], tmp->ui[j] ); vb += vertsize; - *(float *)&vb[0] = x + sz; - *(float *)&vb[1] = y + sz; + LE32_OUT_FLOAT( vb[0], x + sz ); + LE32_OUT_FLOAT( vb[1], y + sz ); for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp->ui[j]; + LE32_OUT( vb[j], tmp->ui[j] ); vb += vertsize; - *(float *)&vb[0] = x - sz; - *(float *)&vb[1] = y + sz; + LE32_OUT_FLOAT( vb[0], x - sz ); + LE32_OUT_FLOAT( vb[1], y + sz ); for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp->ui[j]; + LE32_OUT( vb[j], tmp->ui[j] ); vb += vertsize; - *(float *)&vb[0] = x - sz; - *(float *)&vb[1] = y - sz; + LE32_OUT_FLOAT( vb[0], x - sz ); + LE32_OUT_FLOAT( vb[1], y - sz ); for (j = 2 ; j < vertsize ; j++) - vb[j] = tmp->ui[j]; + LE32_OUT( vb[j], tmp->ui[j] ); + #else int vertsize = rmesa->vertsize; diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_vb.h b/xc/lib/GL/mesa/src/drv/r128/r128_vb.h index 1a00d9eea..797c4c624 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_vb.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_vb.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_vb.h,v 1.4 2001/01/08 01:07:24 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_vb.h,v 1.6 2001/04/10 17:53:07 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -30,6 +30,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Authors: * Gareth Hughes <gareth@valinux.com> * Kevin E. Martin <martin@valinux.com> + * Michel Dänzer <michdaen@iiic.ethz.ch> * */ @@ -38,13 +39,22 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifdef GLX_DIRECT_RENDERING -/* FIXME: This is endian-specific */ +#include "X11/Xarch.h" +#if X_BYTE_ORDER == X_LITTLE_ENDIAN typedef struct { GLubyte blue; GLubyte green; GLubyte red; GLubyte alpha; } r128_color_t; +#else +typedef struct { + GLubyte alpha; + GLubyte red; + GLubyte green; + GLubyte blue; +} r128_color_t; +#endif /* The vertex structure. The final tu1/tv1 values are only used in * multitexture modes, and the rhw2 value is currently never used. diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_dd.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_dd.c index d55809fb8..e055a0241 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_dd.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_dd.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_dd.c,v 1.5 2001/03/25 05:32:00 tsi Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_dd.c,v 1.6 2001/04/10 16:07:53 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -46,7 +46,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "X86/common_x86_asm.h" #endif -#define RADEON_DATE "20010319" +#define RADEON_DATE "20010402" /* Return the width and height of the current color buffer. @@ -79,18 +79,22 @@ static const GLubyte *radeonDDGetString( GLcontext *ctx, GLenum name ) /* Append any chipset-specific information. None yet. */ - /* Append any AGP-specific information. + /* Append any AGP/PCI-specific information. */ - switch ( rmesa->radeonScreen->AGPMode ) { - case 1: - strncat( buffer, " AGP 1x", 7 ); - break; - case 2: - strncat( buffer, " AGP 2x", 7 ); - break; - case 4: - strncat( buffer, " AGP 4x", 7 ); - break; + if ( rmesa->radeonScreen->IsPCI ) { + strncat( buffer, " PCI", 4 ); + } else { + switch ( rmesa->radeonScreen->AGPMode ) { + case 1: + strncat( buffer, " AGP 1x", 7 ); + break; + case 2: + strncat( buffer, " AGP 2x", 7 ); + break; + case 4: + strncat( buffer, " AGP 4x", 7 ); + break; + } } /* Append any CPU-specific information. diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c index 550dcda3c..0889cc9d2 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c,v 1.3 2001/04/01 14:00:00 tsi Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c,v 1.4 2001/04/10 16:07:53 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -386,7 +386,14 @@ static int radeonWaitForFrameCompletion( radeonContextPtr rmesa ) int i; while ( 1 ) { +#if defined(__alpha__) + /* necessary to preserve the Alpha paradigm */ + /* NOTE: this will not work on SPARSE machines */ + mem_barrier(); + frame = *(volatile CARD32 *)(void *)(RADEONMMIO + RADEON_LAST_FRAME_REG); +#else frame = INREG( RADEON_LAST_FRAME_REG ); +#endif if ( sarea->last_frame - frame <= RADEON_MAX_OUTSTANDING ) { break; } @@ -405,7 +412,7 @@ static int radeonWaitForFrameCompletion( radeonContextPtr rmesa ) */ void radeonSwapBuffers( radeonContextPtr rmesa ) { - GLint nbox = rmesa->numClipRects; + GLint nbox; GLint i; GLint ret; @@ -417,6 +424,8 @@ void radeonSwapBuffers( radeonContextPtr rmesa ) LOCK_HARDWARE( rmesa ); + nbox = rmesa->numClipRects; /* must be in locked region */ + /* Throttle the frame rate -- only allow one pending swap buffers * request at a time. */ @@ -607,7 +616,14 @@ static GLbitfield radeonDDClear( GLcontext *ctx, GLbitfield mask, } #else while ( 1 ) { +#if defined(__alpha__) + /* necessary to preserve the Alpha paradigm */ + /* NOTE: this will not work on SPARSE machines */ + mem_barrier(); + clear = *(volatile CARD32 *)(void *)(RADEONMMIO + RADEON_LAST_CLEAR_REG); +#else clear = INREG( RADEON_LAST_CLEAR_REG ); +#endif if ( sarea->last_clear - clear <= RADEON_MAX_CLEARS ) { break; } diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c index e506eea94..aec7677fa 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c,v 1.2 2001/03/21 16:14:24 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_lock.c,v 1.3 2001/04/10 16:07:53 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -71,8 +71,8 @@ void radeonGetLock( radeonContextPtr rmesa, GLuint flags ) */ XMESA_VALIDATE_DRAWABLE_INFO( rmesa->display, sPriv, dPriv ); - if ( rmesa->lastStamp != dPriv->lastStamp ) { - rmesa->lastStamp = dPriv->lastStamp; + if ( rmesa->lastStamp != *(dPriv->pStamp) ) { + rmesa->lastStamp = *(dPriv->pStamp); rmesa->new_state |= RADEON_NEW_WINDOW | RADEON_NEW_CLIP; rmesa->SetupDone = 0; } diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_span.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_span.c index baa8201e1..917f8aa1d 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_span.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_span.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_span.c,v 1.3 2001/03/21 16:14:25 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_span.c,v 1.4 2001/04/10 16:07:53 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -260,6 +260,7 @@ do { \ * Stencil buffer */ +#if 0 /* 24 bit depth, 8 bit stencil depthbuffer functions */ #define WRITE_STENCIL( _x, _y, d ) \ @@ -281,7 +282,7 @@ do { \ #define TAG(x) radeon##x##_24_8 #include "stenciltmp.h" - +#endif void radeonDDInitSpanFuncs( GLcontext *ctx ) diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c index cbef6fcf4..c022bfcd3 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c,v 1.1 2001/03/21 16:14:25 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c,v 1.2 2001/04/10 16:07:53 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -323,12 +323,7 @@ static void radeonUploadSubImage( radeonContextPtr rmesa, GLint texelsPerDword = 0; GLint imageX, imageY, imageWidth, imageHeight; GLint blitX, blitY, blitWidth, blitHeight; - GLint imageRows, blitRows; - GLint remaining; - GLint format, dwords; - CARD32 pitch, offset; - drmBufPtr buffer; - CARD32 *dst; + GLuint format, pitch, offset; GLint ret; if ( RADEON_DEBUG & DEBUG_VERBOSE_TEXTURE ) { diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_texobj.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_texobj.h index 800f3cec4..8ed4ecdb9 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_texobj.h +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_texobj.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_texobj.h,v 1.2 2001/03/21 16:14:25 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_texobj.h,v 1.3 2001/04/10 16:07:53 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -53,10 +53,10 @@ struct radeon_tex_obj { struct gl_texture_object *tObj; /* Mesa texture object */ PMemBlock memBlock; /* Memory block containing texture */ - CARD32 bufAddr; /* Offset to start of locally + GLuint bufAddr; /* Offset to start of locally shared texture block */ - CARD32 dirty_images; /* Flags for whether or not + GLuint dirty_images; /* Flags for whether or not images need to be uploaded to local or AGP texture space */ diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_xmesa.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_xmesa.c index 8a02e3275..6db4d690a 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_xmesa.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_xmesa.c,v 1.3 2001/03/21 16:14:25 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_xmesa.c,v 1.4 2001/04/10 16:07:53 dawes Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -82,7 +82,7 @@ GLboolean XMesaInitDriver( __DRIscreenPrivate *sPriv ) /* Check that the DRM driver version is compatible */ if ( sPriv->drmMajor != 1 || - sPriv->drmMinor < 0 ) { + sPriv->drmMinor < 1 ) { char msg[128]; sprintf( msg, "RADEON DRI driver expected DRM driver version 1.0.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch ); __driMesaMessage( msg ); 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 ba3d3f390..aab9ad73d 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.2 2001/04/01 14:00:00 tsi Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c,v 1.3 2001/04/10 16:07:54 dawes Exp $ */ /* * Original rewrite: @@ -47,7 +47,7 @@ #include "X86/common_x86_asm.h" #endif -#define TDFX_DATE "20010305" +#define TDFX_DATE "20010321" /* These are used in calls to FX_grColorMaskv() */ 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 64648887c..02c574bc5 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.1 2001/03/21 16:14:28 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c,v 1.2 2001/04/10 16:07:54 dawes Exp $ */ /* * Original rewrite: @@ -863,20 +863,8 @@ void tdfxTMFreeTextureLocked( tdfxContextPtr fxMesa, int i; tdfxTMMoveOutTMLocked( fxMesa, tObj ); for ( i = 0 ; i < MAX_TEXTURE_LEVELS ; i++ ) { - if ( t->image[i].original.data ) { - FREE( t->image[i].original.data ); - t->image[i].original.data = NULL; - t->image[i].original.width = 0; - t->image[i].original.height = 0; - t->image[i].original.size = 0; - } - if ( t->image[i].rescaled.data ) { - FREE( t->image[i].rescaled.data ); - t->image[i].rescaled.data = NULL; - t->image[i].rescaled.width = 0; - t->image[i].rescaled.height = 0; - t->image[i].rescaled.size = 0; - } + if ( t->image[i].original.data ) FREE( t->image[i].original.data ); + if ( t->image[i].rescaled.data ) FREE( t->image[i].rescaled.data ); } FREE( t ); tObj->DriverData = NULL; diff --git a/xc/lib/GLU/libnurbs/internals/Imakefile b/xc/lib/GLU/libnurbs/internals/Imakefile index b04e8d99f..221ffe927 100644 --- a/xc/lib/GLU/libnurbs/internals/Imakefile +++ b/xc/lib/GLU/libnurbs/internals/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/GLU/libnurbs/internals/Imakefile,v 1.4 2001/02/18 20:01:02 dawes Exp $ +XCOMM $XFree86: xc/lib/GLU/libnurbs/internals/Imakefile,v 1.5 2001/04/07 17:13:26 dawes Exp $ XCOMM License Applicability. Except to the extent portions of this file are XCOMM made subject to an alternative license as permitted in the SGI Free @@ -138,12 +138,15 @@ OBJS = \ INCLUDES = \ -I../nurbtess \ + -I../../libutil \ -I../../include \ -I$(TOP)/include \ -I$(TOP)/include/GL #if SystemV4 OSDEFINES = -DNEEDCEILF +#else +OSDEFINES = -D_EXTENSIONS_ #endif DEFINES = $(OSDEFINES) \ diff --git a/xc/lib/ICE/ICE-def.cpp b/xc/lib/ICE/ICE-def.cpp index df1d9ea58..fd571ed58 100644 --- a/xc/lib/ICE/ICE-def.cpp +++ b/xc/lib/ICE/ICE-def.cpp @@ -62,5 +62,13 @@ EXPORTS _IceWrite IceListenForWellKnownConnections _IceTransGetHostname + _IceTransSetOption + _IceTransConnect + _IceTransClose + _IceTransOpenCOTSClient + _IceTransGetConnectionNumber + _IceTransRead + _IceTransWrite + /* $Xorg: ICE-def.cpp,v 1.3 2000/08/21 16:42:31 coskrey Exp $ */ -/* $XFree86: xc/lib/ICE/ICE-def.cpp,v 1.4 2001/01/17 19:41:29 dawes Exp $ */ +/* $XFree86: xc/lib/ICE/ICE-def.cpp,v 1.5 2001/04/18 16:13:18 dawes Exp $ */ diff --git a/xc/lib/ICE/Imakefile b/xc/lib/ICE/Imakefile index 49b9f2fe2..e794e3551 100644 --- a/xc/lib/ICE/Imakefile +++ b/xc/lib/ICE/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:44:11 cpqbld Exp $ -XCOMM $XFree86: xc/lib/ICE/Imakefile,v 3.4 2001/01/17 19:41:29 dawes Exp $ +XCOMM $XFree86: xc/lib/ICE/Imakefile,v 3.5 2001/04/23 16:17:06 tsi Exp $ #define DoNormalLib NormalLibICE #define DoSharedLib SharedLibICE @@ -34,7 +34,7 @@ CONN_DEFINES = $(CONNECTION_FLAGS) -DICE_t -DTRANS_CLIENT -DTRANS_SERVER SOCK_DEFINES = -DBSD44SOCKETS #endif -DEPEND_DEFINES = $(TRANS_INCLUDES) $(CONN_DEFINES) +DEPEND_DEFINES = $(TRANS_INCLUDES) $(CONN_DEFINES) DependDefines HEADERS = ICE.h \ ICEconn.h \ diff --git a/xc/lib/SM/Imakefile b/xc/lib/SM/Imakefile index b0f8fda1e..b395fc396 100644 --- a/xc/lib/SM/Imakefile +++ b/xc/lib/SM/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:44:28 cpqbld Exp $ -XCOMM $XFree86: xc/lib/SM/Imakefile,v 1.3 2001/01/17 19:41:31 dawes Exp $ +XCOMM $XFree86: xc/lib/SM/Imakefile,v 1.4 2001/04/23 16:17:07 tsi Exp $ #define DoNormalLib NormalLibSM #define DoSharedLib SharedLibSM @@ -26,7 +26,7 @@ CONN_DEFINES = -DTCPCONN -DICE_t #else CONN_DEFINES = $(CONNECTION_FLAGS) -DICE_t #endif -DEPEND_DEFINES = $(CONN_DEFINES) +DEPEND_DEFINES = $(CONN_DEFINES) DependDefines HEADERS = SM.h \ SMproto.h \ diff --git a/xc/lib/X11/Imakefile b/xc/lib/X11/Imakefile index 7af7007c3..25d6abd7c 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.36 2001/03/21 17:36:44 dawes Exp $ +XCOMM $XFree86: xc/lib/X11/Imakefile,v 3.37 2001/04/23 16:17:07 tsi Exp $ #define DoNormalLib NormalLibX11 #define DoSharedLib SharedLibX11 @@ -93,7 +93,7 @@ EXTRA_LIBRARIES = /**/ #endif DEFINES = $(MALLOC_DEFINES) $(LIB_DEFINES) $(MISC_DEFINES) OPEN_DEFINES = -I$(EXTINCSRC) $(K5INCL) $(K5DEFS) - DEPEND_DEFINES = $(OPEN_DEFINES) $(TRANS_INCLUDES) $(CONN_DEFINES) $(THREADS_DEFINES) + DEPEND_DEFINES = $(OPEN_DEFINES) $(TRANS_INCLUDES) $(CONN_DEFINES) $(THREADS_DEFINES) DependDefines AUTHOBJS = AuDispose.o AuGetBest.o AuFileName.o AuRead.o AUTHSRCS = AuDispose.c AuGetBest.c AuFileName.c AuRead.c SRCS = $(SRCS1) $(SRCS2) $(SRCS3) /* try *.c if you have trouble */ diff --git a/xc/lib/X11/XlibInt.c b/xc/lib/X11/XlibInt.c index 61e5bc1f2..0ba68dd58 100644 --- a/xc/lib/X11/XlibInt.c +++ b/xc/lib/X11/XlibInt.c @@ -22,7 +22,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/X11/XlibInt.c,v 3.25 2001/01/25 16:21:44 keithp Exp $ */ +/* $XFree86: xc/lib/X11/XlibInt.c,v 3.26 2001/04/26 16:23:09 dawes Exp $ */ /* * XlibInt.c - Internal support routines for the C subroutine @@ -1815,7 +1815,13 @@ _XAsyncReply(dpy, rep, buf, lenp, discard) (void) _XSetLastRequestRead(dpy, &rep->generic); len = SIZEOF(xReply) + (rep->generic.length << 2); - + if (len < SIZEOF(xReply)) { + _XIOError (dpy); + buf += *lenp; + *lenp = 0; + return buf; + } + for (async = dpy->async_handlers; async; async = next) { next = async->next; if ((consumed = (*async->handler)(dpy, rep, buf, *lenp, async->data))) diff --git a/xc/lib/Xft/Imakefile b/xc/lib/Xft/Imakefile index 9b62f6212..6265bc53c 100644 --- a/xc/lib/Xft/Imakefile +++ b/xc/lib/Xft/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/Xft/Imakefile,v 1.12 2001/03/30 18:50:18 keithp Exp $ +XCOMM $XFree86: xc/lib/Xft/Imakefile,v 1.14 2001/04/27 14:55:22 tsi Exp $ #define DoNormalLib NormalLibXft #define DoSharedLib SharedLibXft @@ -63,6 +63,8 @@ YaccFilePrefix(xftgram,$(YFLAGS),XftConfig) SpecialCObjectRule(sharedlib,NullParameter,$(SHLIBDEF)) #endif +all:: XftConfig + CppFileTarget(XftConfig,XftConfig.cpp,$(CONFIG_DEFS),$(ICONFIGFILES)) #if InstallFSConfig @@ -71,6 +73,8 @@ InstallNonExecFile(XftConfig,$(XFTLIBDIR)) InstallNonExecFileNoClobber(XftConfig,$(XFTLIBDIR)) #endif +LinkConfFileLong(XftConfig,XftConfig,$(XFTLIBDIR),$(CONFDIR)) + MANSUFFIX = $(LIBMANSUFFIX) InstallManPage(Xft,$(LIBMANDIR)) DependTarget() diff --git a/xc/lib/Xft/XftConfig.cpp b/xc/lib/Xft/XftConfig.cpp index 515fd24f0..cf04051cd 100644 --- a/xc/lib/Xft/XftConfig.cpp +++ b/xc/lib/Xft/XftConfig.cpp @@ -1,28 +1,28 @@ -# $XFree86: xc/lib/Xft/XftConfig.cpp,v 1.5 2000/12/14 23:03:53 keithp Exp $ +XCOMM $XFree86: xc/lib/Xft/XftConfig.cpp,v 1.6 2001/04/27 14:55:22 tsi Exp $ dir XFT_TYPE1_DIR -# -# alias 'fixed' for 'mono' -# +XCOMM +XCOMM alias 'fixed' for 'mono' +XCOMM match any family == "fixed" edit family =+ "mono"; -# -# Check users config file -# +XCOMM +XCOMM Check users config file +XCOMM includeif "~/.xftconfig" -# -# Use Lucidux fonts for default faces -# +XCOMM +XCOMM Use Lucidux fonts for default faces +XCOMM match any family == "serif" edit family += "LuciduxSerif"; match any family == "sans" edit family += "LuciduxSans"; match any family == "mono" edit family += "LuciduxMono"; -# -# Alias between XLFD families and font file family name, prefer local -# fonts -# +XCOMM +XCOMM Alias between XLFD families and font file family name, prefer local +XCOMM fonts +XCOMM match any family == "charter" edit family += "bitstream charter"; match any family == "bitstream charter" edit family =+ "charter"; diff --git a/xc/lib/Xft/xftrender.c b/xc/lib/Xft/xftrender.c index d9233c57e..1be21a65a 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.6 2000/12/20 00:28:45 keithp Exp $ + * $XFree86: xc/lib/Xft/xftrender.c,v 1.7 2001/04/21 16:58:02 keithp Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -197,6 +197,9 @@ XftRenderExtents8 (Display *dpy, 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; @@ -225,26 +228,39 @@ XftRenderExtents8 (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; } diff --git a/xc/lib/Xmuu/Xmuu-def.cpp b/xc/lib/Xmuu/Xmuu-def.cpp new file mode 100644 index 000000000..607e5402f --- /dev/null +++ b/xc/lib/Xmuu/Xmuu-def.cpp @@ -0,0 +1,20 @@ +LIBRARY libXmuu +VERSION LIBRARY_VERSION +EXPORTS + + XmuClientWindow + XmuCursorNameToIndex + XmuPrintDefaultErrorMessage + XmuSimpleErrorHandler + XmuGetHostname + XmuCompareISOLatin1 + XmuCopyISOLatin1Lowered + XmuCopyISOLatin1Uppered + XmuNCopyISOLatin1Lowered + XmuNCopyISOLatin1Uppered + XmuSnprintf + _cygwin_dll_entry@12 + _cygwin_noncygwin_dll_entry@12 + dll_main@12 + +/* $XFree86: xc/lib/Xmuu/Xmuu-def.cpp,v 1.1 2001/04/18 17:14:00 dawes Exp $ */ diff --git a/xc/lib/dps/Imakefile b/xc/lib/dps/Imakefile index 0202c0eb0..8ddef11c9 100644 --- a/xc/lib/dps/Imakefile +++ b/xc/lib/dps/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/lib/dps/Imakefile,v 1.12 2000/05/23 19:32:52 dawes Exp $ +XCOMM $XFree86: xc/lib/dps/Imakefile,v 1.13 2001/04/07 19:41:50 alanh Exp $ #define DoNormalLib NormalLibDps #define DoSharedLib SharedLibDps @@ -231,7 +231,7 @@ ProgramTargetName($(PSWRAP)): HEADERS = psops.h dpsops.h -depend :: $(HEADERS) +includes :: $(HEADERS) depend :: $(DPSOPSCFILES) $(PSOPSCFILES) #ifndef OS2Architecture diff --git a/xc/lib/dps/csconndi.c b/xc/lib/dps/csconndi.c index 88982770c..485720eb3 100644 --- a/xc/lib/dps/csconndi.c +++ b/xc/lib/dps/csconndi.c @@ -47,7 +47,7 @@ * * Author: Adobe Systems Incorporated and MIT X Consortium */ -/* $XFree86: xc/lib/dps/csconndi.c,v 1.5 2000/08/23 21:06:19 dawes Exp $ */ +/* $XFree86: xc/lib/dps/csconndi.c,v 1.6 2001/04/16 20:33:08 tsi Exp $ */ #if defined(sun) && !defined(SVR4) #define memmove(t,f,c) bcopy(f,t,c) @@ -482,7 +482,7 @@ static int MakeDECnetConnection (phostname, iagent, retries, #ifdef UNIXCONN -#ifndef __CYGWIN__ /* causes conflicts with cygwin headers */ +#ifndef X_NO_SYS_UN #include <sys/un.h> #endif diff --git a/xc/lib/font/fontfile/fontenc.c b/xc/lib/font/fontfile/fontenc.c index 08e53d8a5..ad2ed81a2 100644 --- a/xc/lib/font/fontfile/fontenc.c +++ b/xc/lib/font/fontfile/fontenc.c @@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/lib/font/fontfile/fontenc.c,v 1.10 2000/11/14 16:54:45 dawes Exp $ */ +/* $XFree86: xc/lib/font/fontfile/fontenc.c,v 1.11 2001/04/18 16:13:18 dawes Exp $ */ /* Backend-independent encoding code */ @@ -697,11 +697,12 @@ loadEncoding(const char *encoding_name, const char *filename) if(strcasecmp(encoding->name, encoding_name) == 0) { found = 1; } else { - for(alias=encoding->aliases; *alias; alias++) - if(!strcasecmp(*alias, encoding_name)) { - found = 1; - break; - } + if(encoding->aliases) + for(alias=encoding->aliases; *alias; alias++) + if(!strcasecmp(*alias, encoding_name)) { + found = 1; + break; + } } if(!found) { @@ -711,21 +712,24 @@ loadEncoding(const char *encoding_name, const char *filename) char *new_name; int numaliases = 0; - new_name = xalloc(strlen(encoding_name + 1)); + new_name = xalloc(strlen(encoding_name) + 1); if(new_name == NULL) return NULL; strcpy(new_name, encoding_name); - for(alias = encoding->aliases; *alias; alias++) - numaliases++; + if(encoding->aliases) + for(alias = encoding->aliases; *alias; alias++) + numaliases++; new_aliases = (char**)xalloc((numaliases+2)*sizeof(char*)); if(new_aliases == NULL) { xfree(new_name); return NULL; } - memcpy(new_aliases, encoding->aliases, numaliases*sizeof(char*)); + if(numaliases) + memcpy(new_aliases, encoding->aliases, numaliases*sizeof(char*)); new_aliases[numaliases] = new_name; new_aliases[numaliases+1] = NULL; - xfree(encoding->aliases); + if(encoding->aliases) + xfree(encoding->aliases); encoding->aliases = new_aliases; } diff --git a/xc/lib/lbxutil/image/dfaxg42d.c b/xc/lib/lbxutil/image/dfaxg42d.c index ca735365f..adeaa2539 100644 --- a/xc/lib/lbxutil/image/dfaxg42d.c +++ b/xc/lib/lbxutil/image/dfaxg42d.c @@ -22,11 +22,12 @@ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ -/* $XFree86: xc/lib/lbxutil/image/dfaxg42d.c,v 1.5 2001/01/17 19:43:35 dawes Exp $ */ +/* $XFree86: xc/lib/lbxutil/image/dfaxg42d.c,v 1.6 2001/04/23 20:31:05 dawes Exp $ */ #include <X11/Xos.h> #include <X11/Xfuncproto.h> #include <X11/Xfuncs.h> +#include <stdlib.h> #include "g3states.h" #include "lbxfax.h" #include "lbximage.h" diff --git a/xc/lib/lbxutil/image/efaxg42d.c b/xc/lib/lbxutil/image/efaxg42d.c index 9809f66cf..3dd115abb 100644 --- a/xc/lib/lbxutil/image/efaxg42d.c +++ b/xc/lib/lbxutil/image/efaxg42d.c @@ -22,10 +22,11 @@ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ -/* $XFree86: xc/lib/lbxutil/image/efaxg42d.c,v 1.4 2001/01/17 19:43:35 dawes Exp $ */ +/* $XFree86: xc/lib/lbxutil/image/efaxg42d.c,v 1.5 2001/04/23 20:31:05 dawes Exp $ */ #include <X11/Xos.h> #include <X11/Xfuncproto.h> +#include <stdlib.h> #include "lbxfax.h" #include "lbximage.h" #include "lbxbwcodes.h" diff --git a/xc/nls/Compose/Imakefile b/xc/nls/Compose/Imakefile index bbe0a87b7..f5969ae86 100644 --- a/xc/nls/Compose/Imakefile +++ b/xc/nls/Compose/Imakefile @@ -3,31 +3,39 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:48 cpqbld Exp $ -XCOMM $XFree86: xc/nls/Compose/Imakefile,v 1.16 2001/03/06 18:03:17 dawes Exp $ +XCOMM $XFree86: xc/nls/Compose/Imakefile,v 1.17 2001/04/26 21:09:40 dawes Exp $ #ifndef Win32Architecture #ifndef OS2Architecture # define ComposeTarget(name) @@\ -all:: name @@\ +all:: name.ct @@\ MakeDir($(BUILDLIBDIR)/locale/name) @@\ RemoveFile($(BUILDLIBDIR)/locale/name/Compose) @@\ - cd $(BUILDLIBDIR)/locale/name && $(LN) $(BUILDLIBTOP)/../../$(CURRENT_DIR)/name Compose @@\ -InstallNamedNonExec(name,Compose,$(XLOCALEDIR)/name) + cd $(BUILDLIBDIR)/locale/name && $(LN) $(BUILDLIBTOP)/../../$(CURRENT_DIR)/name.ct Compose @@\ + @@\ +CppFileTarget(name.ct,name,$(DEFINES),NullParameter) @@\ + @@\ +InstallNamedNonExec(name.ct,Compose,$(XLOCALEDIR)/name) #else # define ComposeTarget(name) @@\ -all:: name @@\ +all:: name.ct @@\ MakeDir($(BUILDLIBDIR)/locale/name) @@\ - LinkFileSpecial($(BUILDLIBDIR)/locale/name,XLC_LOCALE,$(BUILDLIBTOP)/../../$(CURRENT_DIR)/name) @@\ + LinkFileSpecial($(BUILDLIBDIR)/locale/name,XLC_LOCALE,$(BUILDLIBTOP)/../../$(CURRENT_DIR)/name.ct) @@\ @@\ -InstallNamedNonExec(name,Compose,$(XLOCALEDIR)/name) +CppFileTarget(name.ct,name,$(DEFINES),NullParameter) @@\ + @@\ +InstallNamedNonExec(name.ct,Compose,$(XLOCALEDIR)/name) #endif #else # define ComposeTarget(name) @@\ all:: name @@\ MakeDir(Concat($(BUILDLIBDIR:/=\)\locale\,name)) @@\ RemoveFile(Concat($(BUILDLIBDIR:/=\)\locale\,name\Compose)) @@\ - cd Concat($(BUILDLIBDIR:/=\)\locale\,name) && $(LN) Concat($(BUILDLIBTOP:/=\)\..\..\$(CURRENT_DIR:/=\)\,name) Compose @@\ -InstallNamedNonExec(name,Compose,$(XLOCALEDIR)/name) + cd Concat($(BUILDLIBDIR:/=\)\locale\,name) && $(LN) Concat($(BUILDLIBTOP:/=\)\..\..\$(CURRENT_DIR:/=\)\,name.ct) Compose @@\ + @@\ +CppFileTarget(name.ct,name,$(DEFINES),NullParameter) @@\ + @@\ +InstallNamedNonExec(name.ct,Compose,$(XLOCALEDIR)/name) #endif ComposeTarget(armscii-8) diff --git a/xc/nls/Compose/armscii-8 b/xc/nls/Compose/armscii-8 index 40fd86ff9..08e7fe3ad 100644 --- a/xc/nls/Compose/armscii-8 +++ b/xc/nls/Compose/armscii-8 @@ -1,15 +1,15 @@ -# -# ARMSCII-8 Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/armscii-8,v 1.1 1999/08/28 09:00:33 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM ARMSCII-8 Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/armscii-8,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/georgian-academy b/xc/nls/Compose/georgian-academy index 25cf6220d..707901f6d 100644 --- a/xc/nls/Compose/georgian-academy +++ b/xc/nls/Compose/georgian-academy @@ -1,15 +1,15 @@ -# -# georgian-academy Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/georgian-academy,v 1.1 1999/08/28 09:00:34 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM georgian-academy Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/georgian-academy,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/georgian-ps b/xc/nls/Compose/georgian-ps index 754c9a919..553d6a3d2 100644 --- a/xc/nls/Compose/georgian-ps +++ b/xc/nls/Compose/georgian-ps @@ -1,15 +1,15 @@ -# -# georgian-ps Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/georgian-ps,v 1.1 1999/08/28 09:00:34 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM georgian-ps Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/georgian-ps,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/ibm-cp1133 b/xc/nls/Compose/ibm-cp1133 index ed1ac4ac7..6b2009e06 100644 --- a/xc/nls/Compose/ibm-cp1133 +++ b/xc/nls/Compose/ibm-cp1133 @@ -1,15 +1,15 @@ -# -# ibm-cp1133 Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/ibm-cp1133,v 1.1 1999/08/28 09:00:34 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM ibm-cp1133 Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/ibm-cp1133,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/iso8859-1 b/xc/nls/Compose/iso8859-1 index f7d5abaf9..616d53a54 100644 --- a/xc/nls/Compose/iso8859-1 +++ b/xc/nls/Compose/iso8859-1 @@ -1,14 +1,14 @@ -# $Xorg: iso8859-1,v 1.3 2000/08/17 19:46:59 cpqbld Exp $ -# -# ISO 8859-1 (Latin1) Compose Sequence -# -# -# $XFree86: xc/nls/Compose/iso8859-1,v 1.6 2001/01/17 19:37:05 dawes Exp $ -# -# Sequence Definition -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM $Xorg: iso8859-1,v 1.3 2000/08/17 19:46:59 cpqbld Exp $ +XCOMM +XCOMM ISO 8859-1 (Latin1) Compose Sequence +XCOMM +XCOMM +XCOMM $XFree86: xc/nls/Compose/iso8859-1,v 1.7 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character <Multi_key> <plus> <plus> : "#" numbersign <Multi_key> <apostrophe> <space> : "'" apostrophe <Multi_key> <space> <apostrophe> : "'" apostrophe @@ -174,7 +174,7 @@ <Multi_key> <apostrophe> <apostrophe> : "\264" acute <Multi_key> <comma> <comma> : "\270" cedilla <Multi_key> <quotedbl> <quotedbl> : "\250" diaeresis -# Accented Alphabet +XCOMM Accented Alphabet <Multi_key> <A> <grave> : "\300" Agrave <Multi_key> <grave> <A> : "\300" Agrave <Multi_key> <A> <acute> : "\301" Aacute @@ -378,10 +378,10 @@ <Multi_key> <quotedbl> <y> : "\377" ydiaeresis <Multi_key> <y> <diaeresis> : "\377" ydiaeresis <Multi_key> <diaeresis> <y> : "\377" ydiaeresis -# -# -# dead key accent keysyms -# Special Character +XCOMM +XCOMM +XCOMM dead key accent keysyms +XCOMM Special Character <dead_circumflex> <slash> : "|" bar <dead_grave> <space> : "`" grave <dead_acute> <space> : "'" apostrophe @@ -405,7 +405,7 @@ <dead_acute> <apostrophe> : "\264" acute <dead_cedilla> <comma> : "\270" cedilla <dead_diaeresis> <quotedbl> : "\250" diaeresis -# Accented Alphabet +XCOMM Accented Alphabet <dead_abovering> <A> : "\305" Aring <dead_grave> <A> : "\300" Agrave <dead_acute> <A> : "\301" Aacute @@ -461,19 +461,20 @@ <dead_acute> <Y> : "\335" Yacute <dead_acute> <y> : "\375" yacute <dead_diaeresis> <y> : "\377" ydiaeresis -# Useful for portuguese language +XCOMM Useful for portuguese language <dead_acute> <C> : "\307" Ccedilla <dead_acute> <c> : "\347" ccedilla <dead_acute> <dead_acute> : "'" apostrophe <dead_grave> <dead_grave> : "`" grave -# These are for us_intl, that does not has diaeresis, etc +XCOMM These are for us_intl, that does not has diaeresis, etc <dead_diaeresis> <space> : "\"" quotedbl <dead_diaeresis> <dead_diaeresis> : "\"" quotedbl <dead_tilde> <dead_tilde> : "~" asciitilde <dead_circumflex> <dead_circumflex> : "^" asciicircum -# -# Ctrl<T> Means <Compose> -# Special Character +XCOMM +#ifdef USE_CTRL_SHIFT_T_SEQS +XCOMM Ctrl<T> Means <Compose> +XCOMM Special Character Ctrl<T> <plus> <plus> : "#" numbersign Ctrl<T> <apostrophe> <space> : "'" apostrophe Ctrl<T> <space> <apostrophe> : "'" apostrophe @@ -637,7 +638,7 @@ Ctrl<T> <x> <x> : "\327" multiply Ctrl<T> <apostrophe> <apostrophe> : "\264" acute Ctrl<T> <comma> <comma> : "\270" cedilla Ctrl<T> <quotedbl> <quotedbl> : "\250" diaeresis -# Accented Alphabet +XCOMM Accented Alphabet Ctrl<T> <A> <grave> : "\300" Agrave Ctrl<T> <grave> <A> : "\300" Agrave Ctrl<T> <A> <acute> : "\301" Aacute @@ -839,4 +840,5 @@ Ctrl<T> <y> <quotedbl> : "\377" ydiaeresis Ctrl<T> <quotedbl> <y> : "\377" ydiaeresis Ctrl<T> <y> <diaeresis> : "\377" ydiaeresis Ctrl<T> <diaeresis> <y> : "\377" ydiaeresis -# End of Sequence Definition +#endif /* USE_CTRL_SHIFT_T_SEQS */ +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/iso8859-10 b/xc/nls/Compose/iso8859-10 index 17097aa32..ec3b2e8ab 100644 --- a/xc/nls/Compose/iso8859-10 +++ b/xc/nls/Compose/iso8859-10 @@ -1,15 +1,15 @@ -# -# ISO 8859-10 Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/iso8859-10,v 1.1 1999/08/28 09:00:35 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM ISO 8859-10 Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/iso8859-10,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/iso8859-13 b/xc/nls/Compose/iso8859-13 index deb52dd16..52042bc92 100644 --- a/xc/nls/Compose/iso8859-13 +++ b/xc/nls/Compose/iso8859-13 @@ -1,15 +1,15 @@ -# $XFree86: xc/nls/Compose/iso8859-13,v 1.1 2000/10/27 18:30:50 dawes Exp $ -# -# ISO 8859-13 (Latin7) Compose Sequence -# -# Sequence Definition -# -# <Multi_key> Means <Compose> -# Special Character -# Right-hand side (Accented Alphabet) -# These compose sequences are pure supposition on my part. -# It would be nice to know what the real cultural conventions -# are for compose sequences. +XCOMM $XFree86: xc/nls/Compose/iso8859-13,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM ISO 8859-13 (Latin7) Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character +XCOMM Right-hand side (Accented Alphabet) +XCOMM These compose sequences are pure supposition on my part. +XCOMM It would be nice to know what the real cultural conventions +XCOMM are for compose sequences. <Multi_key> <plus> <plus> : "#" numbersign <Multi_key> <apostrophe> <space> : "'" apostrophe <Multi_key> <space> <apostrophe> : "'" apostrophe @@ -158,7 +158,7 @@ <Multi_key> <minus> <colon> : "\367" division <Multi_key> <colon> <minus> : "\367" division <Multi_key> <x> <x> : "\327" multiply -# Accented Alphabet +XCOMM Accented Alphabet <Multi_key> <A> <semicolon> : "\300" Aogonek <Multi_key> <semicolon> <A> : "\300" Aogonek <Multi_key> <A> <comma> : "\300" Aogonek @@ -430,4 +430,4 @@ <dead_tilde> <asciitilde> : "~" asciitilde <dead_tilde> <dead_tilde> : "~" asciitilde -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/iso8859-14 b/xc/nls/Compose/iso8859-14 index aea91de1d..398afebce 100644 --- a/xc/nls/Compose/iso8859-14 +++ b/xc/nls/Compose/iso8859-14 @@ -1,15 +1,15 @@ -# Alastair McKinstry, <amck@maths.tcd.ie> -# Extensions to allow ISO-8859-14 (Celtic) composing -# -# ISO 8859-14 (Latin-8) Compose Sequence -# -# $XFree86: xc/nls/Compose/iso8859-14,v 1.3 2000/10/27 18:30:51 dawes Exp $ -# -# The following is from the Latin-1 definitions -# Sequence Definition -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM Alastair McKinstry, <amck@maths.tcd.ie> +XCOMM Extensions to allow ISO-8859-14 (Celtic) composing +XCOMM +XCOMM ISO 8859-14 (Latin-8) Compose Sequence +XCOMM +XCOMM $XFree86: xc/nls/Compose/iso8859-14,v 1.4 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM The following is from the Latin-1 definitions +XCOMM Sequence Definition +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character <Multi_key> <plus> <plus> : "#" numbersign <Multi_key> <apostrophe> <space> : "'" apostrophe <Multi_key> <space> <apostrophe> : "'" apostrophe @@ -153,7 +153,7 @@ <Multi_key> <apostrophe> <apostrophe> : "\264" acute <Multi_key> <comma> <comma> : "\270" cedilla <Multi_key> <quotedbl> <quotedbl> : "\250" diaeresis -# Accented Alphabet +XCOMM Accented Alphabet <Multi_key> <A> <grave> : "\300" Agrave <Multi_key> <grave> <A> : "\300" Agrave <Multi_key> <A> <acute> : "\301" Aacute @@ -361,9 +361,9 @@ <Multi_key> <less> <Z> : "\264" Zcaron <Multi_key> <z> <less> : "\270" zcaron <Multi_key> <less> <z> : "\270" zcaron -# -# dead key accent keysyms -# Special Character +XCOMM +XCOMM dead key accent keysyms +XCOMM Special Character <dead_circumflex> <slash> : "|" bar <dead_grave> <space> : "`" grave <dead_acute> <space> : "'" apostrophe @@ -383,7 +383,7 @@ <dead_acute> <apostrophe> : "\264" acute <dead_cedilla> <comma> : "\270" cedilla <dead_diaeresis> <quotedbl> : "\250" diaeresis -# Accented Alphabet +XCOMM Accented Alphabet <dead_grave> <A> : "\300" Agrave <dead_acute> <A> : "\301" Aacute <dead_circumflex> <A> : "\302" Acircumflex @@ -440,8 +440,8 @@ <dead_caron> <Z> : "\264" Zcaron <dead_caron> <z> : "\270" zcaron -# The following is Celtic character support -# +XCOMM The following is Celtic character support +XCOMM <Multi_key> <period> <b> : "¢" bdotabove <Multi_key> <period> <B> : "¡" Bdotabove @@ -585,4 +585,4 @@ <dead_grave> <w> : "¨" Wgrave <dead_grave> <w> : "¸" wgrave -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/iso8859-15 b/xc/nls/Compose/iso8859-15 index f561bd319..3dcb5df97 100644 --- a/xc/nls/Compose/iso8859-15 +++ b/xc/nls/Compose/iso8859-15 @@ -1,13 +1,13 @@ -# $TOG: fcd8859-15 /main/2 1998/06/17 15:53:45 kaleb $ -# -# ISO 8859-15 (Latin1) Compose Sequence -# -# $XFree86: xc/nls/Compose/iso8859-15,v 1.3 2000/10/27 18:30:51 dawes Exp $ -# -# Sequence Definition -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM $TOG: fcd8859-15 /main/2 1998/06/17 15:53:45 kaleb $ +XCOMM +XCOMM ISO 8859-15 (Latin1) Compose Sequence +XCOMM +XCOMM $XFree86: xc/nls/Compose/iso8859-15,v 1.4 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character <Multi_key> <plus> <plus> : "#" numbersign <Multi_key> <apostrophe> <space> : "'" apostrophe <Multi_key> <space> <apostrophe> : "'" apostrophe @@ -156,7 +156,7 @@ <Multi_key> <apostrophe> <apostrophe> : "\264" acute <Multi_key> <comma> <comma> : "\270" cedilla <Multi_key> <quotedbl> <quotedbl> : "\250" diaeresis -# Accented Alphabet +XCOMM Accented Alphabet <Multi_key> <A> <grave> : "\300" Agrave <Multi_key> <grave> <A> : "\300" Agrave <Multi_key> <A> <acute> : "\301" Aacute @@ -374,9 +374,9 @@ <Multi_key> <less> <Z> : "\264" Zcaron <Multi_key> <z> <less> : "\270" zcaron <Multi_key> <less> <z> : "\270" zcaron -# -# dead key accent keysyms -# Special Character +XCOMM +XCOMM dead key accent keysyms +XCOMM Special Character <dead_circumflex> <slash> : "|" bar <dead_grave> <space> : "`" grave <dead_acute> <space> : "'" apostrophe @@ -396,7 +396,7 @@ <dead_acute> <apostrophe> : "\264" acute <dead_cedilla> <comma> : "\270" cedilla <dead_diaeresis> <quotedbl> : "\250" diaeresis -# Accented Alphabet +XCOMM Accented Alphabet <dead_abovering> <A> : "\305" Aring <dead_grave> <A> : "\300" Agrave <dead_acute> <A> : "\301" Aacute @@ -459,9 +459,9 @@ <dead_caron> <z> : "\270" zcaron <dead_circumflex> <Z> : "\264" Zcaron <dead_circumflex> <z> : "\270" zcaron -# Useful for portuguese language +XCOMM Useful for portuguese language <dead_acute> <C> : "\307" Ccedilla <dead_acute> <c> : "\347" ccedilla <dead_acute> <dead_acute> : "'" apostrophe <dead_grave> <dead_grave> : "`" grave -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/iso8859-2 b/xc/nls/Compose/iso8859-2 index e2fbd5753..85e4fe706 100644 --- a/xc/nls/Compose/iso8859-2 +++ b/xc/nls/Compose/iso8859-2 @@ -1,13 +1,13 @@ -# $Xorg: iso8859-2,v 1.3 2000/08/17 19:46:59 cpqbld Exp $ -# -# ISO 8859-2 (Latin2) Compose Sequence -# -# $XFree86: xc/nls/Compose/iso8859-2,v 1.4 2001/01/17 19:37:05 dawes Exp $ -# -# Sequence Definition -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM $Xorg: iso8859-2,v 1.3 2000/08/17 19:46:59 cpqbld Exp $ +XCOMM +XCOMM ISO 8859-2 (Latin2) Compose Sequence +XCOMM +XCOMM $XFree86: xc/nls/Compose/iso8859-2,v 1.5 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character <Multi_key> <plus> <plus> : "#" numbersign <Multi_key> <apostrophe> <space> : "'" apostrophe <Multi_key> <space> <apostrophe> : "'" apostrophe @@ -53,10 +53,10 @@ <Multi_key> <exclam> <p> : "\266" paragraph <Multi_key> <P> <exclam> : "\266" paragraph <Multi_key> <exclam> <P> : "\266" paragraph -# Right-hand side (Accented Alphabet) -# These compose sequences are pure supposition on my part. -# It would be nice to know what the real cultural conventions -# are for compose sequences. +XCOMM Right-hand side (Accented Alphabet) +XCOMM These compose sequences are pure supposition on my part. +XCOMM It would be nice to know what the real cultural conventions +XCOMM are for compose sequences. <Multi_key> <A> <comma> : "\241" Aogonek <Multi_key> <comma> <A> : "\241" Aogonek <Multi_key> <A> <ogonek> : "\241" Aogonek @@ -449,9 +449,9 @@ <dead_ogonek> <E> : "\312" Eogonek <dead_ogonek> <a> : "\261" aogonek <dead_ogonek> <e> : "\352" eogonek -# those are for ease of use +XCOMM those are for ease of use <dead_abovedot> <U> : "\331" Uring <dead_abovedot> <u> : "\371" uring <dead_caron> <U> : "\331" Uring <dead_caron> <u> : "\371" uring -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/iso8859-3 b/xc/nls/Compose/iso8859-3 index 3b15ebe21..b98b25016 100644 --- a/xc/nls/Compose/iso8859-3 +++ b/xc/nls/Compose/iso8859-3 @@ -1,13 +1,13 @@ -# $TOG: fcd8859-15 /main/2 1998/06/17 15:53:45 kaleb $ -# -# ISO 8859-3 (Latin3) Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/iso8859-3,v 1.1 1999/06/06 14:05:57 dawes Exp $ -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM $TOG: fcd8859-15 /main/2 1998/06/17 15:53:45 kaleb $ +XCOMM +XCOMM ISO 8859-3 (Latin3) Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/iso8859-3,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character <Multi_key> <plus> <plus> : "#" numbersign <Multi_key> <apostrophe> <space> : "'" apostrophe <Multi_key> <space> <apostrophe> : "'" apostrophe @@ -103,7 +103,7 @@ <Multi_key> <apostrophe> <apostrophe> : "\264" acute <Multi_key> <comma> <comma> : "\270" cedilla <Multi_key> <quotedbl> <quotedbl> : "\250" diaeresis -# Accented Alphabet +XCOMM Accented Alphabet <Multi_key> <A> <grave> : "\300" Agrave <Multi_key> <grave> <A> : "\300" Agrave <Multi_key> <A> <acute> : "\301" Aacute @@ -373,9 +373,9 @@ <Multi_key> <period> <Z> : "\257" Zabovedot <Multi_key> <z> <period> : "\277" zabovedot <Multi_key> <period> <z> : "\277" zabovedot -# -# dead key accent keysyms -# Special Character +XCOMM +XCOMM dead key accent keysyms +XCOMM Special Character <dead_circumflex> <slash> : "|" bar <dead_grave> <space> : "`" grave <dead_acute> <space> : "'" apostrophe @@ -395,7 +395,7 @@ <dead_acute> <apostrophe> : "\264" acute <dead_cedilla> <comma> : "\270" cedilla <dead_diaeresis> <quotedbl> : "\250" diaeresis -# Accented Alphabet +XCOMM Accented Alphabet <dead_abovering> <A> : "\305" Aring <dead_abovering> <a> : "\345" aring <dead_grave> <A> : "\300" Agrave @@ -476,4 +476,4 @@ <dead_abovedot> <Z> : "\257" Zabovedot <dead_caron> <z> : "\270" zcaron <dead_abovedot> <z> : "\277" zabovedot -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/iso8859-4 b/xc/nls/Compose/iso8859-4 index 25a194028..a04bde67a 100644 --- a/xc/nls/Compose/iso8859-4 +++ b/xc/nls/Compose/iso8859-4 @@ -1,15 +1,15 @@ -# $XFree86: xc/nls/Compose/iso8859-4,v 1.2 2000/10/27 18:30:51 dawes Exp $ -# -# ISO 8859-4 (Latin4) Compose Sequence -# -# Sequence Definition -# -# <Multi_key> Means <Compose> -# Special Character -# Right-hand side (Accented Alphabet) -# These compose sequences are pure supposition on my part. -# It would be nice to know what the real cultural conventions -# are for compose sequences. +XCOMM $XFree86: xc/nls/Compose/iso8859-4,v 1.3 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM ISO 8859-4 (Latin4) Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character +XCOMM Right-hand side (Accented Alphabet) +XCOMM These compose sequences are pure supposition on my part. +XCOMM It would be nice to know what the real cultural conventions +XCOMM are for compose sequences. <Multi_key> <A> <comma> : "\241" Aogonek <Multi_key> <comma> <A> : "\241" Aogonek <Multi_key> <k> <k> : "\242" kra @@ -353,4 +353,4 @@ <dead_tilde> <u> : "\375" utilde <dead_tilde> <asciitilde> : "~" asciitilde <dead_tilde> <dead_tilde> : "~" asciitilde -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/iso8859-5 b/xc/nls/Compose/iso8859-5 index 8f7196a27..bcc9b2f1a 100644 --- a/xc/nls/Compose/iso8859-5 +++ b/xc/nls/Compose/iso8859-5 @@ -1,15 +1,15 @@ -# -# ISO 8859-5 Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/iso8859-5,v 1.1 1999/08/28 09:00:36 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM ISO 8859-5 Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/iso8859-5,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/iso8859-6 b/xc/nls/Compose/iso8859-6 index d625d49cb..438eb91eb 100644 --- a/xc/nls/Compose/iso8859-6 +++ b/xc/nls/Compose/iso8859-6 @@ -1,15 +1,15 @@ -# -# ISO 8859-6 Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/iso8859-6,v 1.1 1999/08/28 09:00:36 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM ISO 8859-6 Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/iso8859-6,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/iso8859-7 b/xc/nls/Compose/iso8859-7 index bf39c074b..6501bd373 100644 --- a/xc/nls/Compose/iso8859-7 +++ b/xc/nls/Compose/iso8859-7 @@ -1,14 +1,14 @@ -# $TOG: iso8859-7 /main/7 1998/05/20 15:33:23 kaleb $ -# -# ISO 8859-7 (Greek) Compose Sequence -# -# -# $XFree86: xc/nls/Compose/iso8859-7,v 1.3 2001/03/23 18:25:11 paulo Exp $ -# -# Sequence Definition -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM $TOG: iso8859-7 /main/7 1998/05/20 15:33:23 kaleb $ +XCOMM +XCOMM ISO 8859-7 (Greek) Compose Sequence +XCOMM +XCOMM +XCOMM $XFree86: xc/nls/Compose/iso8859-7,v 1.4 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character <Multi_key> <plus> <plus> : "#" numbersign <Multi_key> <apostrophe> <space> : "'" apostrophe <Multi_key> <space> <apostrophe> : "'" apostrophe @@ -112,12 +112,12 @@ <Multi_key> <underscore> <asciicircum> : "\257" macron <Multi_key> <asciicircum> <underscore> : "\257" macron <Multi_key> <underscore> <underscore> : "\257" macron -# should be Greek tonos but not defined in X11 +XCOMM should be Greek tonos but not defined in X11 <Multi_key> <apostrophe> <apostrophe> : "\264" acute -# should be Greek dialytika but not defined in X11 +XCOMM should be Greek dialytika but not defined in X11 <Multi_key> <quotedbl> <quotedbl> : "\250" diaeresis -# Accented Alphabet +XCOMM Accented Alphabet <Multi_key> <Greek_ALPHA> <apostrophe> : "\266" Greek_ALPHAaccent <Multi_key> <apostrophe> <Greek_ALPHA> : "\266" Greek_ALPHAaccent <Multi_key> <Greek_EPSILON> <apostrophe>: "\270" Greek_EPSILONaccent @@ -158,10 +158,10 @@ <Multi_key> <Greek_upsilon> <quotedbl> : "\373" Greek_upsilondieresis <Multi_key> <quotedbl> <Greek_upsilon> : "\373" Greek_upsilondieresis -# -# -# dead key accent keysyms -# Special Character +XCOMM +XCOMM +XCOMM dead key accent keysyms +XCOMM Special Character <dead_circumflex> <slash> : "|" bar <dead_grave> <space> : "`" grave <dead_acute> <space> : "'" apostrophe @@ -185,7 +185,7 @@ <dead_acute> <apostrophe> : "\264" acute <dead_diaeresis> <quotedbl> : "\250" diaeresis -# Accented Alphabet (plus some more symbols) +XCOMM Accented Alphabet (plus some more symbols) <dead_acute> <Greek_alpha> : "\334" Greek_alphaaccent <dead_acute> <Greek_epsilon> : "\335" Greek_epsilonaccent <dead_acute> <Greek_eta> : "\336" Greek_etaaccent diff --git a/xc/nls/Compose/iso8859-8 b/xc/nls/Compose/iso8859-8 index 6aaad5db2..37446d243 100644 --- a/xc/nls/Compose/iso8859-8 +++ b/xc/nls/Compose/iso8859-8 @@ -1,15 +1,15 @@ -# -# ISO 8859-8 Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/iso8859-8,v 1.1 1999/08/28 09:00:36 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM ISO 8859-8 Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/iso8859-8,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/iso8859-9 b/xc/nls/Compose/iso8859-9 index be1ddb140..c21eb74f2 100644 --- a/xc/nls/Compose/iso8859-9 +++ b/xc/nls/Compose/iso8859-9 @@ -1,13 +1,13 @@ -# $TOG: fcd8859-15 /main/2 1998/06/17 15:53:45 kaleb $ -# -# ISO 8859-9 (Latin5) Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/iso8859-9,v 1.1 1999/06/06 14:05:57 dawes Exp $ -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM $TOG: fcd8859-15 /main/2 1998/06/17 15:53:45 kaleb $ +XCOMM +XCOMM ISO 8859-9 (Latin5) Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/iso8859-9,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character <Multi_key> <plus> <plus> : "#" numbersign <Multi_key> <apostrophe> <space> : "'" apostrophe <Multi_key> <space> <apostrophe> : "'" apostrophe @@ -155,7 +155,7 @@ <Multi_key> <apostrophe> <apostrophe> : "\264" acute <Multi_key> <comma> <comma> : "\270" cedilla <Multi_key> <quotedbl> <quotedbl> : "\250" diaeresis -# Accented Alphabet +XCOMM Accented Alphabet <Multi_key> <A> <grave> : "\300" Agrave <Multi_key> <grave> <A> : "\300" Agrave <Multi_key> <A> <acute> : "\301" Aacute @@ -388,9 +388,9 @@ <Multi_key> <less> <z> : "\270" zcaron <Multi_key> <v> <Z> : "\264" Zcaron <Multi_key> <v> <z> : "\270" zcaron -# -# dead key accent keysyms -# Special Character +XCOMM +XCOMM dead key accent keysyms +XCOMM Special Character <dead_circumflex> <slash> : "|" bar <dead_grave> <space> : "`" grave <dead_acute> <space> : "'" apostrophe @@ -410,7 +410,7 @@ <dead_acute> <apostrophe> : "\264" acute <dead_cedilla> <comma> : "\270" cedilla <dead_diaeresis> <quotedbl> : "\250" diaeresis -# Accented Alphabet +XCOMM Accented Alphabet <dead_abovering> <A> : "\305" Aring <dead_abovering> <a> : "\345" aring <dead_grave> <A> : "\300" Agrave @@ -475,4 +475,4 @@ <dead_diaeresis> <y> : "\377" ydiaeresis <dead_caron> <Z> : "\264" Zcaron <dead_caron> <z> : "\270" zcaron -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/iso8859-9e b/xc/nls/Compose/iso8859-9e index cacf087b6..7ac314622 100644 --- a/xc/nls/Compose/iso8859-9e +++ b/xc/nls/Compose/iso8859-9e @@ -1,12 +1,12 @@ -# -# ISO 8859-9e (Latin??) Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/iso8859-9e,v 1.1 2000/10/27 18:30:51 dawes Exp $ -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM ISO 8859-9e (Latin??) Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/iso8859-9e,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character <Multi_key> <plus> <plus> : "#" numbersign <Multi_key> <apostrophe> <space> : "'" apostrophe <Multi_key> <space> <apostrophe> : "'" apostrophe @@ -154,7 +154,7 @@ <Multi_key> <apostrophe> <apostrophe> : "\264" acute <Multi_key> <comma> <comma> : "\270" cedilla <Multi_key> <quotedbl> <quotedbl> : "\250" diaeresis -# Accented Alphabet +XCOMM Accented Alphabet <Multi_key> <A> <grave> : "\300" Agrave <Multi_key> <grave> <A> : "\300" Agrave <Multi_key> <A> <acute> : "\301" Aacute @@ -399,9 +399,9 @@ <Multi_key> <less> <o> : "\275" ocaron <Multi_key> <v> <O> : "\264" Ocaron <Multi_key> <v> <o> : "\275" ocaron -# -# dead key accent keysyms -# Special Character +XCOMM +XCOMM dead key accent keysyms +XCOMM Special Character <dead_circumflex> <slash> : "|" bar <dead_grave> <space> : "`" grave <dead_acute> <space> : "'" apostrophe @@ -421,7 +421,7 @@ <dead_acute> <apostrophe> : "\264" acute <dead_cedilla> <comma> : "\270" cedilla <dead_diaeresis> <quotedbl> : "\250" diaeresis -# Accented Alphabet +XCOMM Accented Alphabet <dead_abovering> <A> : "\305" Aring <dead_abovering> <a> : "\345" aring <dead_grave> <A> : "\300" Agrave @@ -486,4 +486,4 @@ <dead_caron> <z> : "\261" zcaron <dead_caron> <G> : "\252" Gcaron <dead_caron> <g> : "\272" gcaron -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/ja b/xc/nls/Compose/ja index 47bd403b9..b7a95a76f 100644 --- a/xc/nls/Compose/ja +++ b/xc/nls/Compose/ja @@ -1,15 +1,15 @@ -# -# ja Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/ja,v 1.1 1999/08/28 09:00:37 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM ja Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/ja,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/ja.JIS b/xc/nls/Compose/ja.JIS index c88514779..45092b62a 100644 --- a/xc/nls/Compose/ja.JIS +++ b/xc/nls/Compose/ja.JIS @@ -1,15 +1,15 @@ -# -# ja.JIS Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/ja.JIS,v 1.1 1999/08/28 09:00:37 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM ja.JIS Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/ja.JIS,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/ja.SJIS b/xc/nls/Compose/ja.SJIS index 64f60acd0..9bce23d04 100644 --- a/xc/nls/Compose/ja.SJIS +++ b/xc/nls/Compose/ja.SJIS @@ -1,15 +1,15 @@ -# -# ja.SJIS Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/ja.SJIS,v 1.1 1999/08/28 09:00:37 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM ja.SJIS Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/ja.SJIS,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/ko b/xc/nls/Compose/ko index 2e91d7446..965289fe3 100644 --- a/xc/nls/Compose/ko +++ b/xc/nls/Compose/ko @@ -1,15 +1,15 @@ -# -# ko Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/ko,v 1.1 1999/08/28 09:00:38 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM ko Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/ko,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/koi8-c b/xc/nls/Compose/koi8-c index 0a39f1be6..11c1cc74a 100644 --- a/xc/nls/Compose/koi8-c +++ b/xc/nls/Compose/koi8-c @@ -1,13 +1,13 @@ -# -# koi8-c Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/koi8-c,v 1.1 2000/10/27 18:30:52 dawes Exp $ -# +XCOMM +XCOMM koi8-c Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/koi8-c,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM -# <Multi_key> Means <Compose> -# Special Character +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character <Multi_key> <plus> <plus> : "#" numbersign <Multi_key> <apostrophe> <space> : "'" apostrophe <Multi_key> <space> <apostrophe> : "'" apostrophe @@ -120,4 +120,4 @@ -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/koi8-r b/xc/nls/Compose/koi8-r index 5fd0119c7..62dba3bf9 100644 --- a/xc/nls/Compose/koi8-r +++ b/xc/nls/Compose/koi8-r @@ -1,15 +1,15 @@ -# -# koi8-r Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/koi8-r,v 1.1 1999/08/28 09:00:38 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM koi8-r Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/koi8-r,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/koi8-u b/xc/nls/Compose/koi8-u index 8625b72f2..e7434980e 100644 --- a/xc/nls/Compose/koi8-u +++ b/xc/nls/Compose/koi8-u @@ -1,15 +1,15 @@ -# -# koi8-u Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/koi8-u,v 1.1 1999/08/28 09:00:38 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM koi8-u Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/koi8-u,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/mk_MK.UTF-8 b/xc/nls/Compose/mk_MK.UTF-8 index a1e61bb53..74b1de16f 100644 --- a/xc/nls/Compose/mk_MK.UTF-8 +++ b/xc/nls/Compose/mk_MK.UTF-8 @@ -1,4 +1,4 @@ -# $XFree86: xc/nls/Compose/mk_MK.UTF-8,v 1.1 2000/12/06 22:00:43 dawes Exp $ +XCOMM $XFree86: xc/nls/Compose/mk_MK.UTF-8,v 1.2 2001/04/26 21:09:40 dawes Exp $ <Multi_key> <Cyrillic_ie> <grave> : 'Ñ' 0x01000450 # Cyrillic_ie_grave <Multi_key> <Cyrillic_IE> <grave> : 'Ѐ' 0x01000400 # Cyrillic_IE_grave <Multi_key> <Cyrillic_i> <grave> : 'Ñ' 0x0100045D # Cyrillic_i_grave diff --git a/xc/nls/Compose/mulelao-1 b/xc/nls/Compose/mulelao-1 index 72f696702..bd218bb7b 100644 --- a/xc/nls/Compose/mulelao-1 +++ b/xc/nls/Compose/mulelao-1 @@ -1,15 +1,15 @@ -# -# mulelao-1 Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/mulelao-1,v 1.1 1999/08/28 09:00:38 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM mulelao-1 Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/mulelao-1,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/vi_VN.tcvn b/xc/nls/Compose/vi_VN.tcvn index b0de3157b..7f2919924 100644 --- a/xc/nls/Compose/vi_VN.tcvn +++ b/xc/nls/Compose/vi_VN.tcvn @@ -1,13 +1,13 @@ -# $XConsortium: iso8859-1 /main/6 1995/11/08 07:24:10 kaleb $ -# $XFree86: xc/nls/Compose/vi_VN.tcvn,v 1.2 2000/10/27 18:30:52 dawes Exp $ -# 1998/12/18 Le Hong Boi $ -# -# TCVN 5712-2 Compose Sequences -# -# Sequence Definition -# -# dead key accent keysyms -# Special Character +XCOMM $XConsortium: iso8859-1 /main/6 1995/11/08 07:24:10 kaleb $ +XCOMM $XFree86: xc/nls/Compose/vi_VN.tcvn,v 1.3 2001/04/26 21:09:40 dawes Exp $ +XCOMM 1998/12/18 Le Hong Boi $ +XCOMM +XCOMM TCVN 5712-2 Compose Sequences +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM dead key accent keysyms +XCOMM Special Character <dead_grave> <space> : "`" grave <dead_acute> <space> : "'" apostrophe <dead_hook> <space> : " " space @@ -15,7 +15,7 @@ <dead_grave> <space> : "`" grave <dead_acute> <space> : "'" apostrophe <dead_acute> <apostrophe> : "\264" acute -# Accented Alphabet +XCOMM Accented Alphabet <dead_grave> <A> : "\200" Agrave <dead_grave> <a> : "\265" agrave <dead_hook> <A> : "\266" Ahook @@ -136,4 +136,4 @@ <dead_acute> <y> : "\375" yacute <dead_belowdot> <Y> : "\376" Ybelowdot <dead_belowdot> <y> : "\376" ybelowdot -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/vi_VN.viscii b/xc/nls/Compose/vi_VN.viscii index 5afd24d10..ac0176c86 100644 --- a/xc/nls/Compose/vi_VN.viscii +++ b/xc/nls/Compose/vi_VN.viscii @@ -1,13 +1,13 @@ -# $XConsortium: iso8859-1 /main/6 1995/11/08 07:24:10 kaleb $ -# $XFree86: xc/nls/Compose/vi_VN.viscii,v 1.2 2000/10/27 18:30:52 dawes Exp $ -# 1998/12/18 Le Hong Boi $ -# -# TCVN 5712-2 Compose Sequences -# -# Sequence Definition -# -# dead key accent keysyms -# Special Character +XCOMM $XConsortium: iso8859-1 /main/6 1995/11/08 07:24:10 kaleb $ +XCOMM $XFree86: xc/nls/Compose/vi_VN.viscii,v 1.3 2001/04/26 21:09:40 dawes Exp $ +XCOMM 1998/12/18 Le Hong Boi $ +XCOMM +XCOMM TCVN 5712-2 Compose Sequences +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM dead key accent keysyms +XCOMM Special Character <dead_grave> <space> : "`" grave <dead_acute> <space> : "'" apostrophe <dead_hook> <space> : " " space @@ -15,7 +15,7 @@ <dead_grave> <space> : "`" grave <dead_acute> <space> : "'" apostrophe <dead_acute> <apostrophe> : "\264" acute -# Accented Alphabet +XCOMM Accented Alphabet <dead_grave> <A> : "\300" Agrave <dead_grave> <a> : "\340" agrave <dead_hook> <A> : "\304" Ahook @@ -136,4 +136,4 @@ <dead_acute> <y> : "\375" yacute <dead_belowdot> <Y> : "\036" Ybelowdot <dead_belowdot> <y> : "\334" ybelowdot -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/zh b/xc/nls/Compose/zh index 339139481..469e9df88 100644 --- a/xc/nls/Compose/zh +++ b/xc/nls/Compose/zh @@ -1,15 +1,15 @@ -# -# zh Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/zh,v 1.1 1999/08/28 09:00:40 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM zh Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/zh,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/zh_CN.gbk b/xc/nls/Compose/zh_CN.gbk index 347c03f8d..eb309f4c3 100644 --- a/xc/nls/Compose/zh_CN.gbk +++ b/xc/nls/Compose/zh_CN.gbk @@ -1,15 +1,15 @@ -# -# zh_CN.GBK Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/zh_CN.gbk,v 1.1 2001/03/06 18:03:17 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM zh_CN.GBK Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/zh_CN.gbk,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/zh_TW b/xc/nls/Compose/zh_TW index 2c3733323..2a4ef7028 100644 --- a/xc/nls/Compose/zh_TW +++ b/xc/nls/Compose/zh_TW @@ -1,15 +1,15 @@ -# -# zh_TW Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/zh_TW,v 1.1 1999/08/28 09:00:40 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM zh_TW Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/zh_TW,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/Compose/zh_TW.big5 b/xc/nls/Compose/zh_TW.big5 index 3308a02eb..c2b7da9b8 100644 --- a/xc/nls/Compose/zh_TW.big5 +++ b/xc/nls/Compose/zh_TW.big5 @@ -1,15 +1,15 @@ -# -# zh_TW.big5 Compose Sequence -# -# Sequence Definition -# -# $XFree86: xc/nls/Compose/zh_TW.big5,v 1.1 1999/08/28 09:00:40 dawes Exp $ -# -# This file currently has no entries. It appears that a compose file (even -# just an empty one) is required for the appropriate keysyms to work for -# this encoding. -# -# <Multi_key> Means <Compose> -# Special Character +XCOMM +XCOMM zh_TW.big5 Compose Sequence +XCOMM +XCOMM Sequence Definition +XCOMM +XCOMM $XFree86: xc/nls/Compose/zh_TW.big5,v 1.2 2001/04/26 21:09:40 dawes Exp $ +XCOMM +XCOMM This file currently has no entries. It appears that a compose file (even +XCOMM just an empty one) is required for the appropriate keysyms to work for +XCOMM this encoding. +XCOMM +XCOMM <Multi_key> Means <Compose> +XCOMM Special Character -# End of Sequence Definition +XCOMM End of Sequence Definition diff --git a/xc/nls/XLC_LOCALE/ko b/xc/nls/XLC_LOCALE/ko index 8f19ea908..557e6e41d 100644 --- a/xc/nls/XLC_LOCALE/ko +++ b/xc/nls/XLC_LOCALE/ko @@ -1,6 +1,7 @@ XCOMM $Xorg: ko,v 1.3 2000/08/17 19:47:00 cpqbld Exp $ XCOMM XLocale Database Sample for ko. XCOMM +XCOMM $XFree86: xc/nls/XLC_LOCALE/ko,v 1.3 2001/04/26 18:11:13 tsi Exp $ XCOMM XCOMM XLC_FONTSET category @@ -22,7 +23,8 @@ fs1 { name KSC5601.1987-0:GL } font { - primary KSC5601.1987-0:GL + primary KSC5601.1987-0:GL + substitute KSC5601.1987-0:GL } } END XLC_FONTSET diff --git a/xc/nls/XLC_LOCALE/zh b/xc/nls/XLC_LOCALE/zh index 5eedd2f97..cc3454e7f 100644 --- a/xc/nls/XLC_LOCALE/zh +++ b/xc/nls/XLC_LOCALE/zh @@ -1,6 +1,7 @@ XCOMM $Xorg: zh,v 1.3 2000/08/17 19:47:00 cpqbld Exp $ XCOMM XLocale Database Sample for zh. XCOMM +XCOMM $XFree86: xc/nls/XLC_LOCALE/zh,v 1.2 2001/04/23 21:41:43 dawes Exp $ XCOMM XCOMM XLC_FONTSET category @@ -23,6 +24,7 @@ fs1 { } font { primary GB2312.1980-0:GL + substitute GB2312.1980-0:GLGR } } END XLC_FONTSET diff --git a/xc/nls/locale.dir b/xc/nls/locale.dir index ec32afb1f..fb7e981c5 100644 --- a/xc/nls/locale.dir +++ b/xc/nls/locale.dir @@ -4,7 +4,7 @@ XCOMM This file contains locale database file name XCOMM The first word is the locale database file name and XCOMM the second word is full locale name. XCOMM -XCOMM $XFree86: xc/nls/locale.dir,v 1.23 2001/03/06 18:54:45 dawes Exp $ +XCOMM $XFree86: xc/nls/locale.dir,v 1.24 2001/04/26 21:09:39 dawes Exp $ XCOMM #ifdef R63_COMPAT XCOMM These entries are in the old format (no ':') @@ -42,8 +42,11 @@ iso8859-2/XLC_LOCALE cz_CZ.ISO8859-2 iso8859-1/XLC_LOCALE da_DK.ISO8859-1 iso8859-15/XLC_LOCALE da_DK.ISO8859-15 iso8859-1/XLC_LOCALE de_AT.ISO8859-1 +iso8859-15/XLC_LOCALE de_AT.ISO8859-15 iso8859-1/XLC_LOCALE de_CH.ISO8859-1 +iso8859-15/XLC_LOCALE de_CH.ISO8859-15 iso8859-1/XLC_LOCALE de_DE.ISO8859-1 +iso8859-15/XLC_LOCALE de_DE.ISO8859-15 iso8859-1/XLC_LOCALE de_LI.ISO8859-1 iso8859-1/XLC_LOCALE de_LU.ISO8859-1 iso8859-7/XLC_LOCALE el_GR.ISO8859-7 @@ -379,8 +382,11 @@ iso8859-2/XLC_LOCALE: cz_CZ.ISO8859-2 iso8859-1/XLC_LOCALE: da_DK.ISO8859-1 iso8859-15/XLC_LOCALE: da_DK.ISO8859-15 iso8859-1/XLC_LOCALE: de_AT.ISO8859-1 +iso8859-15/XLC_LOCALE: de_AT.ISO8859-15 iso8859-1/XLC_LOCALE: de_CH.ISO8859-1 +iso8859-15/XLC_LOCALE: de_CH.ISO8859-15 iso8859-1/XLC_LOCALE: de_DE.ISO8859-1 +iso8859-15/XLC_LOCALE: de_DE.ISO8859-15 iso8859-1/XLC_LOCALE: de_LI.ISO8859-1 iso8859-1/XLC_LOCALE: de_LU.ISO8859-1 iso8859-7/XLC_LOCALE: el_GR.ISO8859-7 diff --git a/xc/programs/Imakefile b/xc/programs/Imakefile index be64af27a..ac12fd324 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.43 2001/04/02 21:12:07 dawes Exp $ +XCOMM $XFree86: xc/programs/Imakefile,v 3.44 2001/04/26 21:27:49 dawes Exp $ #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" @@ -23,13 +23,13 @@ XCOMM $XFree86: xc/programs/Imakefile,v 3.43 2001/04/02 21:12:07 dawes Exp $ #if BuildXKBlib XKBSRCDIRS = setxkbmap xkbcomp xkbevd xkbprint xkbutils #endif -#if BuildScreenSaverExt +#if BuildScreenSaverLibrary SCREENSAVESRCDIR = beforelight #endif -#if BuildXF86VidModeExt +#if BuildXF86VidModeLibrary XVIDTUNESRCDIR = xvidtune #endif -#if BuildXF86DGA +#if BuildXF86DGALibrary XF86DGASRCDIR = xf86dga #endif #if BuildXAServer @@ -46,10 +46,10 @@ SCREENSAVESRCDIR = beforelight XDMSRCDIR = xdm XFINDPROXYSRCDIR = xfindproxy XFWPSRCDIR = xfwp -#if BuildXF86VidModeExt +#if BuildXF86VidModeLibrary XGAMMASRCDIR = xgamma #endif -#if BuildXvExt +#if BuildXvLibrary XVINFOSRCDIR = xvinfo #endif XHOSTSRCDIR = xhost @@ -64,6 +64,14 @@ XFINDPROXYSRCDIR = xfindproxy MKCFMSRCDIR = mkcfm #endif +#if BuildXIElib + XIECLIENTDIRS = xieperf +#endif + +#if BuildXInputLib +XINPUTCLIENTDIRS = xsetmode xsetpointer +#endif + /* makepsres should be considered as part of the DPS libraries */ #if BuildDPSLibraries MAKEPSRESDIR = makepsres @@ -99,10 +107,11 @@ SUBDIRS = \ xcmsdb $(XCONSOLESRCDIR) xditview $(XDMSRCDIR) xdpyinfo \ $(XF86DGASRCDIR) xedit xev xeyes xfd xfontsel $(XFSSRCDIR) xfsinfo \ $(XFINDPROXYSRCDIR) $(XFWPSRCDIR) $(XGAMMASRCDIR) xgc $(XHOSTSRCDIR) \ - xieperf $(XINITSRCDIR) $(XKBSRCDIRS) xkill xload xlogo xlsatoms \ + $(XIECLIENTDIRS) $(XINITSRCDIR) $(XKBSRCDIRS) xkill xload xlogo \ + xlsatoms \ xlsclients xlsfonts xmag xman xmessage xmh xmodmap xprop xrdb \ xrefresh $(XRXSRCDIR) xset \ - xsetroot $(XSMSRCDIR) xstdcmap xsetmode xsetpointer \ + xsetroot $(XSMSRCDIR) xstdcmap $(XINPUTCLIENTDIRS) \ $(XTERMSRCDIR) $(XVIDTUNESRCDIR) xwd xwininfo xwud \ $(XPMCLIENTDIRS) $(XVINFOSRCDIR) \ $(XSSRCDIR) $(XASSRCDIR) $(LBXPROXYSRCDIR) $(SCRIPTSDIR) \ diff --git a/xc/programs/Xserver/GL/Imakefile b/xc/programs/Xserver/GL/Imakefile index bdb63e871..43900b745 100644 --- a/xc/programs/Xserver/GL/Imakefile +++ b/xc/programs/Xserver/GL/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/Imakefile,v 1.7 2000/08/24 22:20:08 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/GL/Imakefile,v 1.8 2001/04/23 16:17:07 tsi Exp $ #define IHaveModules #include <Server.tmpl> @@ -29,7 +29,7 @@ DONES = glx/DONE INCLUDES = -Iinclude -Idri -I$(SERVERSRC)/include -I$(SERVERSRC)/mi \ -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(XF86OSSRC) -DEPEND_DEFINES = $(EXT_DEFINES) +DEPEND_DEFINES = $(EXT_DEFINES) DependDefines DEFINES = $(GLX_DEFINES) #if HasParallelMake diff --git a/xc/programs/Xserver/GL/dri/dri.c b/xc/programs/Xserver/GL/dri/dri.c index 4c6467b6b..483493db2 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.30 2001/03/21 16:21:40 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/dri.c,v 1.31 2001/04/10 16:07:54 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -65,7 +65,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "glxserver.h" #include "mi.h" #include "mipointer.h" -#include "xf86Priv.h" + +#if defined(XFree86LOADER) || defined(PANORAMIX) +extern Bool noPanoramiXExtension; +#endif static int DRIScreenPrivIndex = -1; static int DRIWindowPrivIndex = -1; @@ -88,15 +91,20 @@ static void DRIDestroyDummyContext(ScreenPtr pScreen, Bool hasCtxPriv); This will make it easy to turn off some messages later, based on verbosity level. */ +/* + * Since we're already referencing things from the XFree86 common layer in + * this file, we'd might as well just call xf86VDrvMsgVerb, and have + * consistent message formatting. The verbosity of these messages can be + * easily changed here. + */ +#define DRI_MSG_VERBOSITY 1 static void DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...) { va_list ap; - static char buffer[1024]; va_start(ap, format); - vsprintf(buffer, format, ap); - ErrorF("(%d): %s", scrnIndex, buffer); + xf86VDrvMsgVerb(scrnIndex, type, DRI_MSG_VERBOSITY, format, ap); va_end(ap); } @@ -107,6 +115,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) drmContextPtr reserved; int reserved_count; int i, fd, drmWasAvailable; + Bool xineramaInCore = FALSE; if (DRIGeneration != serverGeneration) { if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0) @@ -114,10 +123,31 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) DRIGeneration = serverGeneration; } + /* + * If Xinerama is on, don't allow DRI to initialise. It won't be usable + * anyway. + */ +#if defined(PANORAMIX) && !defined(XFree86LOADER) + xineramaInCore = TRUE; +#elif defined(XFree86LOADER) + if (xf86LoaderCheckSymbol("noPanoramiXExtension")) + xineramaInCore = TRUE; +#endif + +#if defined(PANORAMIX) || defined(XFree86LOADER) + if (xineramaInCore) { + if (!noPanoramiXExtension) { + DRIDrvMsg(pScreen->myNum, X_WARNING, + "Direct rendering is not supported when Xinerama is enabled\n"); + return FALSE; + } + } +#endif + drmWasAvailable = drmAvailable(); /* Note that drmOpen will try to load the kernel module, if needed. */ - fd = drmOpen(pDRIInfo->drmDriverName, NULL); + fd = drmOpen(pDRIInfo->drmDriverName, NULL /*pDRIInfo->busIdString*/); if (fd < 0) { /* failed to open DRM */ pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; diff --git a/xc/programs/Xserver/GL/dri/drimodule.c b/xc/programs/Xserver/GL/dri/drimodule.c index e4e12df8b..0f56efeec 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.3 2000/02/23 04:46:52 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/drimodule.c,v 1.4 2001/04/10 16:07:55 dawes Exp $ */ /* * Authors: @@ -64,19 +64,34 @@ ExtensionModule XF86DRIExt = NULL }; +static const char *glxSymbols[] = { + "__glXActiveScreens", + NULL +}; + XF86ModuleData driModuleData = { &VersRec, driSetup, NULL }; static pointer driSetup(pointer module, pointer opts, int *errmaj, int *errmin) { + static Bool setupDone = FALSE; pointer drm = NULL; - LoadExtension(&XF86DRIExt, FALSE); + if (!setupDone) { + setupDone = TRUE; + + LoaderRefSymLists(glxSymbols, NULL); + + drm = + LoadSubModule(module, "drm", NULL, NULL, NULL, NULL, errmaj, errmin); - drm = LoadSubModule(module, "drm", NULL, NULL, NULL, NULL, errmaj, errmin); - if (!drm) - ErrorF("Cannot load the drm library\n"); + if (!drm) + ErrorF("Cannot load the drm library\n"); + else + LoadExtension(&XF86DRIExt, FALSE); + } + if (errmaj) *errmaj = LDR_ONCEONLY; /* Need a non-NULL return value to indicate success */ return drm; } diff --git a/xc/programs/Xserver/GL/glxmodule.c b/xc/programs/Xserver/GL/glxmodule.c index a874bb6c9..6965a5562 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.9 2000/02/23 04:46:51 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glxmodule.c,v 1.10 2001/04/10 16:07:54 dawes Exp $ */ /* * Authors: @@ -74,6 +74,7 @@ XF86ModuleData glxModuleData = { &VersRec, glxSetup, NULL }; static pointer glxSetup(pointer module, pointer opts, int *errmaj, int *errmin) { + static Bool setupDone = FALSE; pointer GLcore = NULL; #ifdef GLX_USE_SGI_SI char GLcoreName[] = "GL"; @@ -81,18 +82,24 @@ glxSetup(pointer module, pointer opts, int *errmaj, int *errmin) char GLcoreName[] = "GLcore"; #endif - LoadExtension(&GLXExt, FALSE); + if (!setupDone) { + setupDone = TRUE; - /* Wrap the init visuals routine in micmap.c */ - GlxWrapInitVisuals(&miInitVisualsProc); - /* Make sure this gets wrapped each time InitVisualWrap is called. */ - miHookInitVisuals(NULL, GlxWrapInitVisuals); - - GLcore = LoadSubModule(module, GLcoreName, NULL, NULL, NULL, NULL, + GLcore = LoadSubModule(module, GLcoreName, NULL, NULL, NULL, NULL, errmaj, errmin); - if (!GLcore) - ErrorF("Cannot load the GL core library: %s\n", GLcoreName); - + if (!GLcore) { + ErrorF("Cannot load the GL core library: %s\n", GLcoreName); + } else { + 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); + } + } + + if (errmaj) *errmaj = LDR_ONCEONLY; /* Need a non-NULL return value to indicate success */ return GLcore; } diff --git a/xc/programs/Xserver/GL/mesa/Imakefile b/xc/programs/Xserver/GL/mesa/Imakefile index 45a2e7721..b4e350e9d 100644 --- a/xc/programs/Xserver/GL/mesa/Imakefile +++ b/xc/programs/Xserver/GL/mesa/Imakefile @@ -1,11 +1,11 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/Imakefile,v 1.4 2000/02/23 04:46:54 martin Exp $ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/Imakefile,v 1.5 2001/04/26 16:54:45 dawes Exp $ #define IHaveModules #include <Server.tmpl> #define IHaveSubdirs - SUBDIRS = include src + SUBDIRS = src DEFINES = $(GLX_DEFINES) MakeSubdirs($(SUBDIRS)) diff --git a/xc/programs/Xserver/GL/mesa/src/Imakefile b/xc/programs/Xserver/GL/mesa/src/Imakefile index eb00416b5..870f3ccd7 100644 --- a/xc/programs/Xserver/GL/mesa/src/Imakefile +++ b/xc/programs/Xserver/GL/mesa/src/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.17 2001/03/21 16:41:30 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.18 2001/04/26 16:54:47 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -7,345 +7,11 @@ XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.17 2001/03/21 16:4 SUBDIRS = X -LinkSourceFile(aatriangle.c,$(MESASRCDIR)/src) -LinkSourceFile(aatriangle.h,$(MESASRCDIR)/src) -LinkSourceFile(aatritemp.h,$(MESASRCDIR)/src) -LinkSourceFile(accum.c,$(MESASRCDIR)/src) -LinkSourceFile(accum.h,$(MESASRCDIR)/src) -LinkSourceFile(all.h,$(MESASRCDIR)/src) -LinkSourceFile(alpha.c,$(MESASRCDIR)/src) -LinkSourceFile(alpha.h,$(MESASRCDIR)/src) -LinkSourceFile(alphabuf.c,$(MESASRCDIR)/src) -LinkSourceFile(alphabuf.h,$(MESASRCDIR)/src) -LinkSourceFile(attrib.c,$(MESASRCDIR)/src) -LinkSourceFile(attrib.h,$(MESASRCDIR)/src) -LinkSourceFile(bbox.c,$(MESASRCDIR)/src) -LinkSourceFile(bbox.h,$(MESASRCDIR)/src) -LinkSourceFile(bitmap.c,$(MESASRCDIR)/src) -LinkSourceFile(bitmap.h,$(MESASRCDIR)/src) -LinkSourceFile(blend.c,$(MESASRCDIR)/src) -LinkSourceFile(blend.h,$(MESASRCDIR)/src) -LinkSourceFile(buffers.c,$(MESASRCDIR)/src) -LinkSourceFile(buffers.h,$(MESASRCDIR)/src) -LinkSourceFile(clip.c,$(MESASRCDIR)/src) -LinkSourceFile(clip.h,$(MESASRCDIR)/src) -LinkSourceFile(clip_funcs.h,$(MESASRCDIR)/src) -LinkSourceFile(clip_tmp.h,$(MESASRCDIR)/src) -LinkSourceFile(colortab.c,$(MESASRCDIR)/src) -LinkSourceFile(colortab.h,$(MESASRCDIR)/src) -LinkSourceFile(config.c,$(MESASRCDIR)/src) -LinkSourceFile(config.h,$(MESASRCDIR)/src) -LinkSourceFile(context.c,$(MESASRCDIR)/src) -LinkSourceFile(context.h,$(MESASRCDIR)/src) -LinkSourceFile(copy_tmp.h,$(MESASRCDIR)/src) -LinkSourceFile(copypix.c,$(MESASRCDIR)/src) -LinkSourceFile(copypix.h,$(MESASRCDIR)/src) -LinkSourceFile(cull_tmp.h,$(MESASRCDIR)/src) -LinkSourceFile(cva.c,$(MESASRCDIR)/src) -LinkSourceFile(cva.h,$(MESASRCDIR)/src) -LinkSourceFile(dd.h,$(MESASRCDIR)/src) -LinkSourceFile(ddsample.c,$(MESASRCDIR)/src) -LinkSourceFile(debug_xform.c,$(MESASRCDIR)/src) -LinkSourceFile(debug_xform.h,$(MESASRCDIR)/src) -LinkSourceFile(depth.c,$(MESASRCDIR)/src) -LinkSourceFile(depth.h,$(MESASRCDIR)/src) -LinkSourceFile(dispatch.c,$(MESASRCDIR)/src) -LinkSourceFile(dlist.c,$(MESASRCDIR)/src) -LinkSourceFile(dlist.h,$(MESASRCDIR)/src) -LinkSourceFile(dotprod_tmp.h,$(MESASRCDIR)/src) -LinkSourceFile(drawpix.c,$(MESASRCDIR)/src) -LinkSourceFile(drawpix.h,$(MESASRCDIR)/src) -LinkSourceFile(enable.c,$(MESASRCDIR)/src) -LinkSourceFile(enable.h,$(MESASRCDIR)/src) -LinkSourceFile(enums.c,$(MESASRCDIR)/src) -LinkSourceFile(enums.h,$(MESASRCDIR)/src) -LinkSourceFile(eval.c,$(MESASRCDIR)/src) -LinkSourceFile(eval.h,$(MESASRCDIR)/src) -LinkSourceFile(extensions.c,$(MESASRCDIR)/src) -LinkSourceFile(extensions.h,$(MESASRCDIR)/src) -LinkSourceFile(feedback.c,$(MESASRCDIR)/src) -LinkSourceFile(feedback.h,$(MESASRCDIR)/src) -LinkSourceFile(fixed.h,$(MESASRCDIR)/src) -LinkSourceFile(fog.c,$(MESASRCDIR)/src) -LinkSourceFile(fog.h,$(MESASRCDIR)/src) -LinkSourceFile(fog_tmp.h,$(MESASRCDIR)/src) -LinkSourceFile(general_clip.h,$(MESASRCDIR)/src) -LinkSourceFile(get.c,$(MESASRCDIR)/src) -LinkSourceFile(get.h,$(MESASRCDIR)/src) -LinkSourceFile(glapi.h,$(MESASRCDIR)/src) -LinkSourceFile(glapi.c,$(MESASRCDIR)/src) -LinkSourceFile(glapioffsets.h,$(MESASRCDIR)/src) -LinkSourceFile(glapinoop.c,$(MESASRCDIR)/src) -LinkSourceFile(glapinoop.h,$(MESASRCDIR)/src) -LinkSourceFile(glapitable.h,$(MESASRCDIR)/src) -LinkSourceFile(glapitemp.h,$(MESASRCDIR)/src) -LinkSourceFile(glheader.h,$(MESASRCDIR)/src) -LinkSourceFile(glthread.c,$(MESASRCDIR)/src) -LinkSourceFile(glthread.h,$(MESASRCDIR)/src) -LinkSourceFile(hash.c,$(MESASRCDIR)/src) -LinkSourceFile(hash.h,$(MESASRCDIR)/src) -LinkSourceFile(hint.c,$(MESASRCDIR)/src) -LinkSourceFile(hint.h,$(MESASRCDIR)/src) -LinkSourceFile(highpc.c,$(MESASRCDIR)/src) -LinkSourceFile(image.c,$(MESASRCDIR)/src) -LinkSourceFile(image.h,$(MESASRCDIR)/src) -LinkSourceFile(imaging.c,$(MESASRCDIR)/src) -LinkSourceFile(imaging.h,$(MESASRCDIR)/src) -LinkSourceFile(indirect_tmp.h,$(MESASRCDIR)/src) -LinkSourceFile(interp_tmp.h,$(MESASRCDIR)/src) -LinkSourceFile(light.c,$(MESASRCDIR)/src) -LinkSourceFile(light.h,$(MESASRCDIR)/src) -LinkSourceFile(lines.c,$(MESASRCDIR)/src) -LinkSourceFile(lines.h,$(MESASRCDIR)/src) -LinkSourceFile(linetemp.h,$(MESASRCDIR)/src) -LinkSourceFile(lnaatemp.h,$(MESASRCDIR)/src) -LinkSourceFile(logic.c,$(MESASRCDIR)/src) -LinkSourceFile(logic.h,$(MESASRCDIR)/src) -LinkSourceFile(lowpc.c,$(MESASRCDIR)/src) -LinkSourceFile(macros.h,$(MESASRCDIR)/src) -LinkSourceFile(masking.c,$(MESASRCDIR)/src) -LinkSourceFile(masking.h,$(MESASRCDIR)/src) -LinkSourceFile(matrix.c,$(MESASRCDIR)/src) -LinkSourceFile(matrix.h,$(MESASRCDIR)/src) -LinkSourceFile(mem.c,$(MESASRCDIR)/src) -LinkSourceFile(mem.h,$(MESASRCDIR)/src) -LinkSourceFile(mmath.c,$(MESASRCDIR)/src) -LinkSourceFile(mmath.h,$(MESASRCDIR)/src) -LinkSourceFile(norm_tmp.h,$(MESASRCDIR)/src) -LinkSourceFile(pb.c,$(MESASRCDIR)/src) -LinkSourceFile(pb.h,$(MESASRCDIR)/src) -LinkSourceFile(pipeline.c,$(MESASRCDIR)/src) -LinkSourceFile(pipeline.h,$(MESASRCDIR)/src) -LinkSourceFile(pixel.c,$(MESASRCDIR)/src) -LinkSourceFile(pixel.h,$(MESASRCDIR)/src) -LinkSourceFile(pixeltex.c,$(MESASRCDIR)/src) -LinkSourceFile(pixeltex.h,$(MESASRCDIR)/src) -LinkSourceFile(points.c,$(MESASRCDIR)/src) -LinkSourceFile(points.h,$(MESASRCDIR)/src) -LinkSourceFile(polygon.c,$(MESASRCDIR)/src) -LinkSourceFile(polygon.h,$(MESASRCDIR)/src) -LinkSourceFile(quads.c,$(MESASRCDIR)/src) -LinkSourceFile(quads.h,$(MESASRCDIR)/src) -LinkSourceFile(rastpos.c,$(MESASRCDIR)/src) -LinkSourceFile(rastpos.h,$(MESASRCDIR)/src) -LinkSourceFile(readpix.c,$(MESASRCDIR)/src) -LinkSourceFile(readpix.h,$(MESASRCDIR)/src) -LinkSourceFile(rect.c,$(MESASRCDIR)/src) -LinkSourceFile(rect.h,$(MESASRCDIR)/src) -LinkSourceFile(render_tmp.h,$(MESASRCDIR)/src) -LinkSourceFile(scissor.c,$(MESASRCDIR)/src) -LinkSourceFile(scissor.h,$(MESASRCDIR)/src) -LinkSourceFile(shade.c,$(MESASRCDIR)/src) -LinkSourceFile(shade.h,$(MESASRCDIR)/src) -LinkSourceFile(shade_tmp.h,$(MESASRCDIR)/src) -LinkSourceFile(simple_list.h,$(MESASRCDIR)/src) -LinkSourceFile(span.c,$(MESASRCDIR)/src) -LinkSourceFile(span.h,$(MESASRCDIR)/src) -LinkSourceFile(stages.c,$(MESASRCDIR)/src) -LinkSourceFile(stages.h,$(MESASRCDIR)/src) -LinkSourceFile(state.c,$(MESASRCDIR)/src) -LinkSourceFile(state.h,$(MESASRCDIR)/src) -LinkSourceFile(stencil.c,$(MESASRCDIR)/src) -LinkSourceFile(stencil.h,$(MESASRCDIR)/src) -LinkSourceFile(texformat.c, $(MESASRCDIR)/src) -LinkSourceFile(texformat.h, $(MESASRCDIR)/src) -LinkSourceFile(texgen_tmp.h,$(MESASRCDIR)/src) -LinkSourceFile(teximage.c,$(MESASRCDIR)/src) -LinkSourceFile(teximage.h,$(MESASRCDIR)/src) -LinkSourceFile(texobj.c,$(MESASRCDIR)/src) -LinkSourceFile(texobj.h,$(MESASRCDIR)/src) -LinkSourceFile(texstate.c,$(MESASRCDIR)/src) -LinkSourceFile(texstate.h,$(MESASRCDIR)/src) -LinkSourceFile(texture.c,$(MESASRCDIR)/src) -LinkSourceFile(texture.h,$(MESASRCDIR)/src) -LinkSourceFile(trans_tmp.h,$(MESASRCDIR)/src) -LinkSourceFile(translate.c,$(MESASRCDIR)/src) -LinkSourceFile(translate.h,$(MESASRCDIR)/src) -LinkSourceFile(triangle.c,$(MESASRCDIR)/src) -LinkSourceFile(triangle.h,$(MESASRCDIR)/src) -LinkSourceFile(tritemp.h,$(MESASRCDIR)/src) -LinkSourceFile(types.h,$(MESASRCDIR)/src) -LinkSourceFile(varray.c,$(MESASRCDIR)/src) -LinkSourceFile(varray.h,$(MESASRCDIR)/src) -LinkSourceFile(vb.c,$(MESASRCDIR)/src) -LinkSourceFile(vb.h,$(MESASRCDIR)/src) -LinkSourceFile(vbcull.c,$(MESASRCDIR)/src) -LinkSourceFile(vbcull.h,$(MESASRCDIR)/src) -LinkSourceFile(vbfill.c,$(MESASRCDIR)/src) -LinkSourceFile(vbfill.h,$(MESASRCDIR)/src) -LinkSourceFile(vbindirect.c,$(MESASRCDIR)/src) -LinkSourceFile(vbindirect.h,$(MESASRCDIR)/src) -LinkSourceFile(vbrender.c,$(MESASRCDIR)/src) -LinkSourceFile(vbrender.h,$(MESASRCDIR)/src) -LinkSourceFile(vbxform.c,$(MESASRCDIR)/src) -LinkSourceFile(vbxform.h,$(MESASRCDIR)/src) -LinkSourceFile(vector.c,$(MESASRCDIR)/src) -LinkSourceFile(vector.h,$(MESASRCDIR)/src) -LinkSourceFile(vertices.c,$(MESASRCDIR)/src) -LinkSourceFile(vertices.h,$(MESASRCDIR)/src) -LinkSourceFile(winpos.c,$(MESASRCDIR)/src) -LinkSourceFile(winpos.h,$(MESASRCDIR)/src) -LinkSourceFile(xform.c,$(MESASRCDIR)/src) -LinkSourceFile(xform.h,$(MESASRCDIR)/src) -LinkSourceFile(xform_tmp.h,$(MESASRCDIR)/src) -LinkSourceFile(zoom.c,$(MESASRCDIR)/src) -LinkSourceFile(zoom.h,$(MESASRCDIR)/src) +#define NeedAllMesaSrc +#define NeedToLinkMesaSrc +#define MesaBuildDir /**/ - CORE_SRCS = aatriangle.c \ - accum.c \ - alpha.c \ - alphabuf.c \ - attrib.c \ - bbox.c \ - bitmap.c \ - blend.c \ - buffers.c \ - clip.c \ - colortab.c \ - config.c \ - context.c \ - copypix.c \ - cva.c \ - debug_xform.c \ - depth.c \ - dispatch.c \ - dlist.c \ - drawpix.c \ - enable.c \ - enums.c \ - eval.c \ - extensions.c \ - feedback.c \ - fog.c \ - get.c \ - glapi.c \ - glapinoop.c \ - hash.c \ - hint.c \ - image.c \ - imaging.c \ - light.c \ - lines.c \ - logic.c \ - masking.c \ - matrix.c \ - mem.c \ - mmath.c \ - pb.c \ - pipeline.c \ - pixel.c \ - pixeltex.c \ - points.c \ - polygon.c \ - quads.c \ - rastpos.c \ - readpix.c \ - rect.c \ - scissor.c \ - shade.c \ - span.c \ - stages.c \ - state.c \ - stencil.c \ - texformat.c \ - teximage.c \ - texobj.c \ - texstate.c \ - texture.c \ - translate.c \ - triangle.c \ - varray.c \ - vb.c \ - vbcull.c \ - vbfill.c \ - vbindirect.c \ - vbrender.c \ - vbxform.c \ - vector.c \ - vertices.c \ - winpos.c \ - xform.c \ - zoom.c - - CORE_OBJS = aatriangle.o \ - accum.o \ - alpha.o \ - alphabuf.o \ - attrib.o \ - bbox.o \ - bitmap.o \ - blend.o \ - buffers.o \ - clip.o \ - colortab.o \ - config.o \ - context.o \ - copypix.o \ - cva.o \ - debug_xform.o \ - depth.o \ - dispatch.o \ - dlist.o \ - drawpix.o \ - enable.o \ - enums.o \ - eval.o \ - extensions.o \ - feedback.o \ - fog.o \ - get.o \ - glapi.o \ - glapinoop.o \ - glthread.o \ - hash.o \ - hint.o \ - image.o \ - imaging.o \ - light.o \ - lines.o \ - logic.o \ - masking.o \ - matrix.o \ - mem.o \ - mmath.o \ - pb.o \ - pipeline.o \ - pixel.o \ - pixeltex.o \ - points.o \ - polygon.o \ - quads.o \ - rastpos.o \ - readpix.o \ - rect.o \ - scissor.o \ - shade.o \ - span.o \ - stages.o \ - state.o \ - stencil.o \ - texformat.o \ - teximage.o \ - texobj.o \ - texstate.o \ - texture.o \ - translate.o \ - triangle.o \ - varray.o \ - vb.o \ - vbcull.o \ - vbfill.o \ - vbindirect.o \ - vbrender.o \ - vbxform.o \ - vector.o \ - vertices.o \ - winpos.o \ - xform.o \ - zoom.o - - ASM_SRCS = asm_386.S - ASM_OBJS = asm_386.o +#include "../../../../../lib/GL/mesa/src/Imakefile.inc" #if DoLoadableServer MSRCS = GLcoremodule.c @@ -354,13 +20,13 @@ LinkSourceFile(zoom.h,$(MESASRCDIR)/src) XOBJS = X/?*.o #endif - SRCS = $(CORE_SRCS) /*$(ASM_SRCS)*/ $(MSRCS) - OBJS = $(CORE_OBJS) /*$(ASM_OBJS)*/ $(MOBJS) + SRCS = $(COREMESASRCS) $(MSRCS) + OBJS = $(COREMESAOBJS) $(MOBJS) - INCLUDES = -I. -I../include -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ - -I../../include -I../../glx + INCLUDES = -I$(INCLUDESRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) \ + -I$(MESASRCDIR)/src -I$(SERVERSRC)/include - DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM */ + DEFINES = $(GLX_DEFINES) #if DoLoadableServer DONES = X/DONE diff --git a/xc/programs/Xserver/GL/mesa/src/X/Imakefile b/xc/programs/Xserver/GL/mesa/src/X/Imakefile index 7704ffecc..0c90fe00f 100644 --- a/xc/programs/Xserver/GL/mesa/src/X/Imakefile +++ b/xc/programs/Xserver/GL/mesa/src/X/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/X/Imakefile,v 1.8 2000/08/01 20:28:40 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/X/Imakefile,v 1.9 2001/04/26 16:54:47 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -7,11 +7,8 @@ LinkSourceFile(xmesa1.c,$(MESASRCDIR)/src/X) LinkSourceFile(xmesa2.c,$(MESASRCDIR)/src/X) LinkSourceFile(xmesa3.c,$(MESASRCDIR)/src/X) LinkSourceFile(xmesa4.c,$(MESASRCDIR)/src/X) -LinkSourceFile(xmesaP.h,$(MESASRCDIR)/src/X) -LinkSourceFile(glxheader.h,$(MESASRCDIR)/src/X) LinkSourceFile(compsize.c,$(LIBSRC)/GL/glx) -LinkSourceFile(size.h,$(LIBSRC)/GL/glx) DRIVER_SRCS = xmesa1.c xmesa2.c xmesa3.c xmesa4.c DRIVER_OBJS = xmesa1.o xmesa2.o xmesa3.o xmesa4.o @@ -22,11 +19,12 @@ LinkSourceFile(size.h,$(LIBSRC)/GL/glx) SRCS = $(DRIVER_SRCS) $(GLX_SRCS) OBJS = $(DRIVER_OBJS) $(GLX_OBJS) - INCLUDES = -I. -I.. -I../../include \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ - -I../../../include -I../../../glx \ - -I$(LIBSRC)/GL/include \ - -I$(XF86SRC) -I$(XTOP)/include + INCLUDES = -I. -I$(INCLUDESRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) \ + -I$(MESASRCDIR)/src -I$(MESASRCDIR)/src/X \ + -I$(MESASRCDIR)/include \ + -I$(LIBSRC)/GL/glx -I$(LIBSRC)/GL/include \ + -I$(SERVERSRC)/include -I$(SERVERSRC)/GL/include \ + -I$(SERVERSRC)/GL/glx DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ diff --git a/xc/programs/Xserver/Imakefile b/xc/programs/Xserver/Imakefile index 9f42af34c..3c656e191 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.217 2001/04/05 20:13:42 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.226 2001/04/26 21:27:49 dawes Exp $ #ifndef InstallXserverSetUID #define InstallXserverSetUID NO @@ -21,7 +21,7 @@ INSTPGMFLAGS = #define BarePostFbLibs $(MFB) $(XPFBLIBS) $(MI) #define PostFbLibs BarePostFbLibs $(EXTENSIONS) #define NoMfbBarePostFbLibs $(XPFBLIBS) $(MI) -#ifndef BuildXinerama +#if !BuildXinerama #define NoMfbPostFbLibs NoMfbBarePostFbLibs $(EXTENSIONS) #else #define NoMfbPostFbLibs $(EXTENSIONS) NoMfbBarePostFbLibs $(EXTENSIONS) @@ -104,7 +104,8 @@ INSTPGMFLAGS = XIDIR = Xi #endif #if BuildXIE - XIEEXT = XIE/dixie/ModuleLibraryTargetName(dixie) XIE/mixie/ModuleLibraryTargetName(mixie) + XIEEXT = XIE/dixie/ModuleLibraryTargetName(dixie) \ + XIE/mixie/ModuleLibraryTargetName(mixie) #endif #if BuildXIE || BuildXIElib XIEDIR = XIE @@ -173,7 +174,8 @@ XPMPCLLIB = Xprint/pcl-mono/LibraryTargetName(pcl) XPPSLIB = Xprint/ps/LibraryTargetName(ps) #endif -XPDDXLIBS = Xprint/LibraryTargetName(printer) $(XPRASTLIB) $(XPPCLLIB) $(XPMPCLLIB) $(XPPSLIB) +XPDDXLIBS = Xprint/LibraryTargetName(printer) \ + $(XPRASTLIB) $(XPPCLLIB) $(XPMPCLLIB) $(XPPSLIB) XPDDXFBLIBS = $(MFB) $(CFB32) #if !PrintOnlyServer XPFBLIBS = $(XPDDXFBLIBS) @@ -230,13 +232,19 @@ XPFBLIBS = dix/LibraryTargetName(xpstubs) #else MFB = mfb/LibraryTargetName(mfb) FB = fb/LibraryTargetName(fb) - CFB = cfb/LibraryTargetName(cfb) cfb16/LibraryTargetName(cfb16) \ - cfb24/LibraryTargetName(cfb24) cfb32/LibraryTargetName(cfb32) + CFB = cfb/LibraryTargetName(cfb) \ + cfb16/LibraryTargetName(cfb16) \ + cfb24/LibraryTargetName(cfb24) \ + cfb32/LibraryTargetName(cfb32) CFB8 = cfb/LibraryTargetName(cfb) - CFB4 = cfb/LibraryTargetName(cfb) cfb4/LibraryTargetName(cfb4) - CFB16 = cfb/LibraryTargetName(cfb) cfb16/LibraryTargetName(cfb16) - CFB24 = cfb/LibraryTargetName(cfb) cfb24/LibraryTargetName(cfb24) - CFB32 = cfb/LibraryTargetName(cfb) cfb32/LibraryTargetName(cfb32) + CFB4 = cfb/LibraryTargetName(cfb) \ + cfb4/LibraryTargetName(cfb4) + CFB16 = cfb/LibraryTargetName(cfb) \ + cfb16/LibraryTargetName(cfb16) + CFB24 = cfb/LibraryTargetName(cfb) \ + cfb24/LibraryTargetName(cfb24) + CFB32 = cfb/LibraryTargetName(cfb) \ + cfb32/LibraryTargetName(cfb32) SHADOW = miext/shadow/LibraryTargetName(shadow) #endif #if BuildLowMem @@ -270,7 +278,7 @@ XPFBLIBS = dix/LibraryTargetName(xpstubs) DBMLIBS = DBMLibrary #endif SYSLIBS = $(ZLIB) MathLibrary Krb5Libraries $(DBMLIBS) $(USB) \ - $(PAMLIBS) $(EXTRASYSLIBS) + $(PAMLIBS) $(EXTRASYSLIBS) CBRT = mi/LibraryTargetName(cbrt) STDDIRS = include dix os mi $(XPDDXDIR) $(EXTDIRS) @@ -331,7 +339,8 @@ DECLIBS = hw/dec/ws/LibraryTargetName(dec) LMFCFBLibs #else DECLIBS = hw/dec/ws/LibraryTargetName(dec) CFB8Libs #endif -ServerTarget(Xdec,$(DECDIRS),$(DECOBJS),$(DECLIBS),$(FONTLIBS) $(SYSLIBS)) +ServerTarget(Xdec,$(DECDIRS),$(DECOBJS), \ + $(DECLIBS),$(FONTLIBS) $(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall Xdec #endif @@ -349,10 +358,13 @@ CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR1 = hw/dec/ws -DECDIRS1 = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) +DECDIRS1 = $(STDDIRS) $(MFBDIR) \ + $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) \ + $(DDXDIR1) $(DEPDIRS) DECOBJS1 = hw/dec/ws/init.o hw/dec/ws/mdepthinit.o DECLIBS1 = hw/dec/ws/LibraryTargetName(dec) CFBLibs -ServerTarget(Xdec_md,$(DECDIRS1),$(DECOBJS1),$(DECLIBS1),$(FONTLIBS) $(SYSLIBS)) +ServerTarget(Xdec_md,$(DECDIRS1),$(DECOBJS1), \ + $(DECLIBS1),$(FONTLIBS) $(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall Xdec_md #endif @@ -379,7 +391,8 @@ SUNDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS) SUNLIBS = hw/sun/LibraryTargetName(sun) CFB8Libs #endif SUNSYSLIBS = $(FONTLIBS) $(WIDECHARSYSLIB) $(SYSLIBS) -SetUIDServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS),$(SUNLIBS),$(SUNSYSLIBS)) +SetUIDServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS), \ + $(SUNLIBS),$(SUNSYSLIBS)) #ifndef ServerToInstall #define ServerToInstall Xsun #endif @@ -396,10 +409,13 @@ CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR1 = hw/sun -SUN24DIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) +SUN24DIRS = $(STDDIRS) $(MFBDIR) \ + $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) \ + $(DDXDIR1) $(DEPDIRS) SUN24OBJS = hw/sun/sunInitMulti.o SUN24LIBS = hw/sun/LibraryTargetName(sun) CFBLibs -SetUIDServerTarget(Xsun24,$(SUN24DIRS),$(SUN24OBJS),$(SUN24LIBS),$(FONTLIBS) $(SYSLIBS)) +SetUIDServerTarget(Xsun24,$(SUN24DIRS),$(SUN24OBJS), \ + $(SUN24LIBS),$(FONTLIBS) $(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall Xsun24 #endif @@ -414,8 +430,9 @@ MFBDIR = mfb DDXDIR1 = hw/sun SUNMDIRS = $(STDDIRS) $(MFBDIR) $(DDXDIR1) $(DEPDIRS) SUNMOBJS = hw/sun/sunInitMono.o hw/sun/sunInExMono.o -SUNMLIBS = hw/sun/LibraryTargetName(sun) MFBBareLibs $(OTHEREXTS) -SetUIDServerTarget(XsunMono,$(SUNMDIRS),$(SUNMOBJS),$(SUNMLIBS),$(FONTLIBS) $(SYSLIBS)) +SUNMLIBS = hw/sun/LibraryTargetName(sun) MFBBareLibs $(EXTENSIONS) +SetUIDServerTarget(XsunMono,$(SUNMDIRS),$(SUNMOBJS), \ + $(SUNMLIBS),$(FONTLIBS) $(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XsunMono #endif @@ -432,7 +449,8 @@ 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)) +ServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS), \ + $(SUNLIBS),$(FONTLIBS) $(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall Xsun #endif @@ -448,7 +466,8 @@ 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)) +ServerTarget(XsunMono,$(SUNMDIRS),$(SUNMOBJS), \ + $(SUNMLIBS),$(FONTLIBS) $(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XsunMono #endif @@ -465,7 +484,8 @@ DDXDIR1 = hw/sunLynx SUNDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS) SUNOBJS = hw/sunLynx/sunLyInit.o SUNLIBS = hw/sunLynx/libsun.a CFB8Libs -ServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS),$(SUNLIBS),$(FONTLIBS) $(SYSLIBS)) +ServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS), \ + $(SUNLIBS),$(FONTLIBS) $(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall Xsun #endif @@ -481,35 +501,14 @@ DDXDIR1 = hw/sunLynx SUNMDIRS = $(STDDIRS) $(MFBDIR) $(DDXDIR1) $(DEPDIRS) SUNMOBJS = hw/sunLynx/sunInitMono.o hw/sunLynx/sunInExMono.o SUNMLIBS = hw/sunLynx/libsun.a MFBBareLibs $(OTHEREXTS) -ServerTarget(XsunMono,$(SUNMDIRS),$(SUNMOBJS),$(SUNMLIBS),$(FONTLIBS) $(SYSLIBS)) +ServerTarget(XsunMono,$(SUNMDIRS),$(SUNMOBJS), \ + $(SUNMLIBS),$(FONTLIBS) $(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XsunMono #endif #endif /* XsunLynxMonoServer */ -#if XibmServer -XCOMM -XCOMM IBM server -XCOMM -#if SpecialMalloc -IBMALLOCLIB = hw/ibm/common/LibraryTargetName(ibmalloc) -#else -IBMALLOCLIB = -#endif -MFBDIR = mfb -CFB8DIR = cfb -DDXDIR1 = hw/ibm -IBMDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS) -IBMOBJS = hw/ibm/common/ibmcomm.o hw/ibm/common/ibmDate.o -IBMLIBS = hw/ibm/AIX/hft.o hw/ibm/LibraryTargetName(ibm) $(IBMALLOCLIB) CFB8Libs -ServerTarget(Xibm,$(IBMDIRS),$(IBMOBJS),$(IBMLIBS),$(FONTLIBS) $(SYSLIBS)) -#ifndef ServerToInstall -#define ServerToInstall Xibm -#endif -#endif /* XibmServer */ - - #if XhpServer XCOMM XCOMM Hewlett Packard CFB Server @@ -527,7 +526,8 @@ HPSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) HPLIBS = CFB32Libs #endif HPSYSLIBS = $(FONTLIBS) $(CBRT) $(SYSLIBS) -ServerTarget(Xhp,$(HPSUBDIRS),$(HPOBJS),$(HPLIBS),$(HPSYSLIBS)) +ServerTarget(Xhp,$(HPSUBDIRS),$(HPOBJS), \ + $(HPLIBS),$(HPSYSLIBS)) #ifndef ServerToInstall #define ServerToInstall Xhp #endif @@ -575,7 +575,9 @@ SHADOWDIR = miext/shadow AFBDIR = afb #endif DDXDIR1 = hw/xfree86 -XF86SERVERSUBDIRS = $(STDDIRS) $(MFBDIR) $(FBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(AFBDIR) $(SHADOWDIR) $(DDXDIR1) $(DEPDIRS) +XF86SERVERSUBDIRS = $(STDDIRS) $(MFBDIR) $(FBDIR) $(AFBDIR) \ + $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) \ + $(SHADOWDIR) $(DDXDIR1) $(DEPDIRS) XF86INIT = $(XF86COMSRC)/xf86Init.o $(XF86COMSRC)/xf86IniExt.o XF86COMLIB = $(XF86COMSRC)/LibraryTargetName(xf86) XF86PARSLIB= $(XF86PARSERSRC)/LibraryTargetName(xf86config) @@ -649,14 +651,16 @@ XF86DRVLIBS = $(XF86DRIVERLIB) $(XF86RAMDACLIB) $(XF86DDCLIB) $(XF86I2CLIB) \ XF86IDRVOBJS = $(XF86SRC)/input/drvConf.o XF86IDRVLIBS = $(XF86IDRIVERLIB) XF86SCANLIB = $(XF86SRC)/scanpci/LibraryTargetName(scanpci) -XF86LIBS = $(MEMDEBUGLIB) $(XF86INIT) $(XF86COMLIB) $(XF86RACLIB) $(XF86PARSLIB) \ - $(XF86OSLIB) $(XF86INT10LIB) +XF86LIBS = $(MEMDEBUGLIB) $(XF86INIT) $(XF86COMLIB) $(XF86RACLIB) \ + $(XF86PARSLIB) $(XF86OSLIB) $(XF86INT10LIB) #else -XF86LIBS = $(MEMDEBUGLIB) $(XF86INIT) $(XF86COMLIB) $(XF86PARSLIB) $(XF86OSLIB) +XF86LIBS = $(MEMDEBUGLIB) $(XF86INIT) $(XF86COMLIB) \ + $(XF86PARSLIB) $(XF86OSLIB) #endif #if DoLoadableServer XF86LOADERLIB = $(XF86SRC)/loader/LibraryTargetName(loader) -XF86MAINLIBS = MiExtLibs PreFbLibsNoFont $(FONTBASE) $(OTHEREXTS) $(XF86COMLIB) \ +XF86MAINLIBS = MiExtLibs PreFbLibsNoFont \ + $(FONTBASE) $(OTHEREXTS) $(XF86COMLIB) \ NoMfbPostFbLibs XF86SERVERSYSLIBS = $(SYSLIBS) $(LIBDL) $(LIBREGEX) #else @@ -674,7 +678,8 @@ MakeMutex($(XF86SERVERSUBDIRS) $(XF86SERVERLIBS) $(XF86SERVERSYSLIBS)) $(XF86SERVERLIBS) $(XF86SERVERSYSLIBS):: $(XF86SERVERSUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif -SetUIDServerTarget(XFree86,$(XF86SERVERSUBDIRS),$(XF86SERVEROBJS),$(XF86SERVERLIBS),$(XF86SERVERSYSLIBS)) +SetUIDServerTarget(XFree86,$(XF86SERVERSUBDIRS),$(XF86SERVEROBJS), \ + $(XF86SERVERLIBS),$(XF86SERVERSYSLIBS)) #if DoLoadableServer ServerDriverSDKTarget(XFree86) #endif @@ -736,8 +741,9 @@ MakeMutex($(FBDEVDIRS) $(FBDEVOBJS) $(FBDEVLIBS) $(FBDEVSYSLIBS)) $(FBDEVOBJS) $(XFBDEV) $(FBDEVLIBS) $(FBDEVSYSLIBS):: $(FBDEVDIRS) @if [ -f $@ ]; then touch $@; fi #endif -ServerTarget(Xfbdev,$(FBDEVDIRS),$(FBDEVOBJS),$(FBDEVLIBS),$(FBDEVSYSLIBS)) -#endif /* XFBDEVServer */ +ServerTarget(Xfbdev,$(FBDEVDIRS),$(FBDEVOBJS), \ + $(FBDEVLIBS),$(FBDEVSYSLIBS)) +#endif /* XfbdevServer */ #if XSavageServer XCOMM @@ -761,8 +767,9 @@ MakeMutex($(SAVAGEDIRS) $(SAVAGEOBJS) $(SAVAGELIBS) $(SAVAGESYSLIBS)) $(SAVAGEOBJS) $(XSAVAGE) $(SAVAGELIBS) $(SAVAGESYSLIBS):: $(SAVAGEDIRS) @if [ -f $@ ]; then touch $@; fi #endif -ServerTarget(Xsavage,$(SAVAGEDIRS),$(SAVAGEOBJS),$(SAVAGELIBS),$(SAVAGESYSLIBS)) -#endif /* XSAVAGEServer */ +ServerTarget(Xsavage,$(SAVAGEDIRS),$(SAVAGEOBJS), \ + $(SAVAGELIBS),$(SAVAGESYSLIBS)) +#endif /* XSavageServer */ #if XIgsServer XCOMM @@ -786,8 +793,9 @@ MakeMutex($(IGSDIRS) $(IGSOBJS) $(IGSLIBS) $(IGSSYSLIBS)) $(IGSOBJS) $(XIGS) $(IGSLIBS) $(IGSSYSLIBS):: $(IGSDIRS) @if [ -f $@ ]; then touch $@; fi #endif -ServerTarget(Xigs,$(IGSDIRS),$(IGSOBJS),$(IGSLIBS),$(IGSSYSLIBS)) -#endif /* XIGSServer */ +ServerTarget(Xigs,$(IGSDIRS),$(IGSOBJS), \ + $(IGSLIBS),$(IGSSYSLIBS)) +#endif /* XIgsServer */ #if XTridentServer XCOMM @@ -804,7 +812,8 @@ XCOMM KDDIRS = StdKdDirs - TRIDENTDIRS = $(STDDIRS) $(KDDIRS) $(FBDEVDIR) $(VESADIR) $(SHADOWDIR) $(TRIDENTDIR) + TRIDENTDIRS = $(STDDIRS) $(KDDIRS) \ + $(FBDEVDIR) $(VESADIR) $(SHADOWDIR) $(TRIDENTDIR) TRIDENTLIBS = PreFbLibs $(TRIDENT) $(FBDEV) $(VESA) KdLibs FbPostFbLibs TRIDENTSYSLIBS = StdKdSysLibs @@ -816,8 +825,9 @@ MakeMutex($(TRIDENTDIRS) $(TRIDENTLIBS) $(TRIDENTSYSLIBS)) $(TRIDENTOBJS) $(TRIDENTLIBS) $(TRIDENTSYSLIBS):: $(TRIDENTDIRS) @if [ -f $@ ]; then touch $@; fi #endif -ServerTarget(Xtrident,$(TRIDENTDIRS),$(TRIDENTOBJS),$(TRIDENTLIBS),$(TRIDENTSYSLIBS)) -#endif /* XTRIDENTServer */ +ServerTarget(Xtrident,$(TRIDENTDIRS),$(TRIDENTOBJS), \ + $(TRIDENTLIBS),$(TRIDENTSYSLIBS)) +#endif /* XTridentServer */ #if Xi810Server XCOMM @@ -846,7 +856,8 @@ MakeMutex($(I810DIRS) $(I810LIBS) $(I810SYSLIBS)) $(I810OBJS) $(I810LIBS) $(I810SYSLIBS):: $(I810DIRS) @if [ -f $@ ]; then touch $@; fi #endif -ServerTarget(Xi810,$(I810DIRS),$(I810OBJS),$(I810LIBS),$(I810SYSLIBS)) +ServerTarget(Xi810,$(I810DIRS),$(I810OBJS), \ + $(I810LIBS),$(I810SYSLIBS)) #endif /* Xi810Server */ @@ -872,8 +883,9 @@ MakeMutex($(SIS530DIRS) $(SIS530OBJS) $(SIS530LIBS) $(SIS530SYSLIBS)) $(SIS530OBJS) $(SIS530LIBS) $(SIS530SYSLIBS):: $(SIS530DIRS) @if [ -f $@ ]; then touch $@; fi #endif -ServerTarget(Xsis530,$(SIS530DIRS),$(SIS530OBJS),$(SIS530LIBS),$(SIS530SYSLIBS)) -#endif /* XSIS530Server */ +ServerTarget(Xsis530,$(SIS530DIRS),$(SIS530OBJS), \ + $(SIS530LIBS),$(SIS530SYSLIBS)) +#endif /* XSis530Server */ #if XTrioServer XCOMM @@ -897,8 +909,9 @@ MakeMutex($(TRIODIRS) $(TRIOOBJS) $(TRIOLIBS) $(TRIOSYSLIBS)) $(TRIOOBJS) $(TRIOLIBS) $(TRIOSYSLIBS):: $(TRIODIRS) @if [ -f $@ ]; then touch $@; fi #endif -ServerTarget(Xtrio,$(TRIODIRS),$(TRIOOBJS),$(TRIOLIBS),$(TRIOSYSLIBS)) -#endif /* XTRIOServer */ +ServerTarget(Xtrio,$(TRIODIRS),$(TRIOOBJS), \ + $(TRIOLIBS),$(TRIOSYSLIBS)) +#endif /* XTrioServer */ #if XTS300Server XCOMM @@ -928,7 +941,8 @@ MakeMutex($(TS300DIRS) $(TS300OBJS) $(TS300LIBS) $(TS300SYSLIBS)) $(TS300OBJS) $(TS300LIBS) $(TS300SYSLIBS):: $(TS300DIRS) @if [ -f $@ ]; then touch $@; fi #endif -ServerTarget(Xts300,$(TS300DIRS),$(TS300OBJS),$(TS300LIBS),$(TS300SYSLIBS)) +ServerTarget(Xts300,$(TS300DIRS),$(TS300OBJS), \ + $(TS300LIBS),$(TS300SYSLIBS)) #endif /* XTS300Server */ #if XItsyServer @@ -952,7 +966,8 @@ MakeMutex($(ITSYDIRS) $(ITSYOBJS) $(ITSYLIBS) $(ITSYSYSLIBS)) $(ITSYOBJS) $(ITSYLIBS) $(ITSYSYSLIBS):: $(ITSYDIRS) @if [ -f $@ ]; then touch $@; fi #endif -ServerTarget(Xitsy,$(ITSYDIRS),$(ITSYOBJS),$(ITSYLIBS),$(ITSYSYSLIBS)) +ServerTarget(Xitsy,$(ITSYDIRS),$(ITSYOBJS), \ + $(ITSYLIBS),$(ITSYSYSLIBS)) #endif /* XItsyServer */ #if XvesaServer @@ -979,11 +994,12 @@ MakeMutex($(VESADIRS) $(VESAOBJS) $(VESALIBS) $(VESASYSLIBS)) $(VESAOBJS) $(XVESA) $(VESALIBS) $(VESASYSLIBS):: $(VESADIRS) @if [ -f $@ ]; then touch $@; fi #endif -ServerTarget(Xvesa,$(VESADIRS),$(VESAOBJS),$(VESALIBS),$(VESASYSLIBS)) +ServerTarget(Xvesa,$(VESADIRS),$(VESAOBJS), \ + $(VESALIBS),$(VESASYSLIBS)) #endif /* XvesaServer */ -KDRIVEDIRS=$(KDDIRS) $(FBDEVDIR) $(SAVAGEDIR) $(TRIDENTDIR) $(I810DIR) $(SIS530DIR) \ - $(TRIODIR) $(TS300DIR) $(ITSYDIR) $(IGSDIR) $(VESADIR) +KDRIVEDIRS=$(KDDIRS) $(FBDEVDIR) $(SAVAGEDIR) $(TRIDENTDIR) $(I810DIR) \ + $(SIS530DIR) $(TRIODIR) $(TS300DIR) $(ITSYDIR) $(IGSDIR) $(VESADIR) #endif /* KDriveXServer */ #if XprtServer @@ -1004,7 +1020,8 @@ XPLIBS = PreFbLibs $(XPDDXLIBS) $(XPDDXFBLIBS) PostFbLibs XPOBJS = Xprint/ddxInit.o XPLIBS = PreFbLibs PostFbLibs #endif -#if (defined(SunArchitecture) || defined(SparcArchitecture)) && defined(SVR4Architecture) +#if (defined(SunArchitecture) || defined(SparcArchitecture)) && \ + defined(SVR4Architecture) XPSYSLIBS = $(FONTLIBS) $(CBRT) $(SYSLIBS) -lw #else XPSYSLIBS = $(FONTLIBS) $(CBRT) $(SYSLIBS) @@ -1016,7 +1033,8 @@ MakeMutex($(XPSUBDIRS) $(XPOBJS) $(XPLIBS) $(XPSYSLIBS)) $(XPOBJS) $(XPLIBS) $(XPSYSLIBS):: $(XPSUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif -ServerTarget(Xprt,$(XPSUBDIRS),$(XPOBJS),$(XPLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER),$(XPSYSLIBS)) +ServerTarget(Xprt,$(XPSUBDIRS),$(XPOBJS), \ + $(XPLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER),$(XPSYSLIBS)) #endif /* XprtServer */ #if XnestServer @@ -1029,17 +1047,15 @@ XNESTDDXDIR = hw/xnest XNESTDDXDIR = hw #endif XNESTDIRS = $(STDDIRS) $(XNESTDDXDIR) $(DEPDIRS) -#if !defined(LynxOSArchitecture) && !defined(Win32Architecture) && !defined(QNX4Architecture) +#if !defined(LynxOSArchitecture) && \ + !defined(Win32Architecture) && \ + !defined(QNX4Architecture) XNESTOBJS = hw/xnest/miinitext.o #else XNESTOBJS = hw/xnest/miinitext.o dix/main.o #endif XNEST = hw/xnest/LibraryTargetName(xnest) -#if DoLoadableServer XNESTLIBS = PreFbLibs $(XNEST) NoMfbPostFbLibs $(XNEST) -#else -XNESTLIBS = PreFbLibs $(XNEST) NoMfbPostFbLibs $(XF86OSLIB) $(XNEST) -#endif XNESTSYSLIBS = $(FONTLIBS) $(LDPRELIBS) $(XLIB) $(SYSLIBS) #if HasParallelMake MakeMutex($(XNESTDIRS) $(XNESTOBJS) $(XNESTLIBS) $(XNESTSYSLIBS)) @@ -1072,7 +1088,7 @@ Xnon: $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB32DIR) $(DEPDIRS) XCOMM XCOMM server with Virtual (malloced) framebuffer XCOMM -MFBDIR = mfb +MFBDIR = mfb FBDIR = fb #if defined(Win32Architecture) XVFBDDXDIR = hw @@ -1089,11 +1105,7 @@ XVFBOBJS = $(XVFBDDXDIR)/stubs.o $(XVFBDDXDIR)/miinitext.o $(XVFBDPMSSTUBOBJS) XVFBOBJS = dix/main.o hw/vfb/stubs.o hw/vfb/miinitext.o #endif XVFB = $(XVFBDDXDIR)/LibraryTargetName(vfb) -#if DoLoadableServer XVFBLIBS = PreFbLibs $(XVFB) $(FB) PostFbLibs $(MI) -#else -XVFBLIBS = PreFbLibs $(XVFB) $(FB) PostFbLibs $(XF86OSLIB) $(MI) -#endif XVFBSYSLIBS = $(FONTLIBS) $(SYSLIBS) #if HasParallelMake MakeMutex($(XVFBDIRS) $(XVFBOBJS) $(XVFB) $(XVFBLIBS) $(XVFBSYSLIBS)) @@ -1113,9 +1125,10 @@ XCOMM server with DirectX framebuffer for Windows XCOMM XWINDDXDIR = hw/xwin XWIN = $(XWINDDXDIR)/LibraryTargetName(XWin) -XWINGDI32 = /lib/libgdi32.a -XWINDDRAW = /lib/libddraw.a -/* XWINOLE32 = /lib/libole32.a */ +XWINGDI32 = -lgdi32 +XWINDDRAW = -lddraw +/* XWINOLE32 = -lole32 */ +SHADOWDIR = miext/shadow DDXDIR1 = $(XWINDDXDIR) XWINDIRS = $(STDDIRS) $(FB) $(SHADOW) $(XWINDDXDIR) $(DEPDIRS) @@ -1153,15 +1166,18 @@ ServerTarget(XWin,$(XWINDIRS),$(XWINOBJS), \ XCOMM XCOMM X Darwin server for Mac OS X / Darwin XCOMM -MFBDIR = mfb /* mfb is needed for font stuff, even though we don't support a 1bpp screen */ -CFB8DIR = cfb +MFBDIR = mfb +CFB8DIR = cfb CFB16DIR = cfb16 CFB32DIR = cfb32 -DDXDIR1 = hw/darwin -DDXDIR2 = hw/darwin/bundle -DARWINDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) +DDXDIR1 = hw/darwin +DDXDIR2 = hw/darwin/bundle +DARWINDIRS = $(STDDIRS) $(MFBDIR) \ + $(CFB8DIR) $(CFB16DIR) $(CFB32DIR) \ + $(DDXDIR1) $(DEPDIRS) DARWINOBJS = $(DDXDIR1)/xfIOKitStartup.o -DARWINLIBS = PreFbLibs $(DDXDIR1)/LibraryTargetName(darwin) $(CFB16) $(CFB32) $(CFB8) PostFbLibs +DARWINLIBS = PreFbLibs $(DDXDIR1)/LibraryTargetName(darwin) \ + $(CFB16) $(CFB32) $(CFB8) PostFbLibs DARWINSYSLIBS = $(FONTLIBS) $(SYSLIBS) -framework IOKit /* @@ -1180,7 +1196,11 @@ SetUIDServerTarget(XDarwin,$(DARWINDIRS),$(DARWINOBJS), \ QUARTZSYSLIBS = -framework ApplicationServices -framework Cocoa \ -framework CoreAudio -framework Carbon -ObjC QUARTZOBJS = $(DDXDIR2)/quartzStartup.o +#if NothingOutsideProjectRoot XDARWINAPPDIR = $(DESTDIR)$(BINDIR)/XDarwin.app/Contents/MacOS +#else +XDARWINAPPDIR = /Applications/XDarwin.app/Contents/MacOS +#endif /* * Quartz X server (installed in its application bundle) @@ -1192,6 +1212,8 @@ SetUIDServerTarget(XDarwinApp,$(DARWINDIRS),$(QUARTZOBJS), \ install:: mkdir -p $(XDARWINAPPDIR) mv $(DESTDIR)$(BINDIR)/XDarwinApp $(XDARWINAPPDIR)/XDarwin + -(cd $(DESTDIR)$(BINDIR); $(RM) XDarwinQuartz; \ + $(LN) $(XDARWINAPPDIR)/XDarwin XDarwinQuartz) #else /* !DarwinQuartzSupport */ @@ -1209,7 +1231,9 @@ DDXDIRS = $(DDXDIR1) $(DDXDIR2) $(DDXDIR3) $(XVFBDDXDIR) $(XNESTDDXDIR) SUBDIRS = $(STDDIRS) $(MFBDIR) $(CFBDIRS) $(IPLANDIRS) $(ILBMDIR) $(AFBDIR) \ $(LMFCFBDIR) $(DDXDIRS) $(FBDIR) $(KDRIVEDIRS) $(MIEXTDIRS) -#if defined(ServerToInstall) && !defined(OS2Architecture) && !defined(QNX4Architecture) +#if defined(ServerToInstall) && \ + !defined(OS2Architecture) && \ + !defined(QNX4Architecture) install:: -(cd $(DESTDIR)$(BINDIR); $(RM) X; $(LN) ServerToInstall X) #endif diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level4/Imakefile b/xc/programs/Xserver/PEX5/ddpex/mi/level4/Imakefile index 6c827c608..6b6c779e0 100644 --- a/xc/programs/Xserver/PEX5/ddpex/mi/level4/Imakefile +++ b/xc/programs/Xserver/PEX5/ddpex/mi/level4/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:47:09 cpqbld Exp $ XCOMM XCOMM XCOMM -XCOMM $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level4/Imakefile,v 3.13 2001/01/17 22:12:29 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level4/Imakefile,v 3.14 2001/04/23 16:17:07 tsi Exp $ XCOMM XCOMM XCOMM Copyright 1989, 1990, 1991 by Sun Microsystems, Inc. and the X Consortium @@ -38,8 +38,7 @@ XCOMM -D defines for ddpex: XCOMM DDTEST turns on some fprintf(stderr...)s for debugging DEFINES = PexDdpexDefines -EXT_DEFINES = ExtensionDefines -DEPEND_DEFINES = $(EXT_DEFINES) +DEPEND_DEFINES = $(EXT_DEFINES) DependDefines CDEBUGFLAGS = PexDdpexCDebugFlags PEXSERVINC = ../../../include diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/shared/Imakefile b/xc/programs/Xserver/PEX5/ddpex/mi/shared/Imakefile index 6f0e0d4e0..066002442 100644 --- a/xc/programs/Xserver/PEX5/ddpex/mi/shared/Imakefile +++ b/xc/programs/Xserver/PEX5/ddpex/mi/shared/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:47:10 cpqbld Exp $ XCOMM XCOMM XCOMM -XCOMM $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/Imakefile,v 3.13 2001/01/17 22:12:31 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/shared/Imakefile,v 3.14 2001/04/23 16:17:08 tsi Exp $ XCOMM XCOMM XCOMM Copyright 1989, 1990, 1991 by Sun Microsystems, Inc. and the X Consortium @@ -39,7 +39,6 @@ XCOMM DDTEST turns on some fprintf(stderr...)s for debugging XCOMM PEX_DEFAULT_FONTPATH defines the default path to PEX fonts DEFINES = PexDdpexDefines -EXT_DEFINES = ExtensionDefines CDEBUGFLAGS = PexDdpexCDebugFlags PEXSERVINC = ../../../include diff --git a/xc/programs/Xserver/Xext/xvmc.c b/xc/programs/Xserver/Xext/xvmc.c index d94432cd1..620a17802 100644 --- a/xc/programs/Xserver/Xext/xvmc.c +++ b/xc/programs/Xserver/Xext/xvmc.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/Xext/xvmc.c,v 1.3 2001/04/01 14:00:03 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xvmc.c,v 1.4 2001/04/07 11:04:21 alanh Exp $ */ #define NEED_REPLIES #define NEED_EVENTS @@ -16,7 +16,7 @@ #include "XvMC.h" #include "Xvproto.h" #include "XvMCproto.h" -#include "xvmc.h" +#include "xvmcext.h" int XvMCScreenIndex = -1; diff --git a/xc/programs/Xserver/Xext/xvmcext.h b/xc/programs/Xserver/Xext/xvmcext.h new file mode 100644 index 000000000..b18a75511 --- /dev/null +++ b/xc/programs/Xserver/Xext/xvmcext.h @@ -0,0 +1,109 @@ +/* $XFree86: xc/programs/Xserver/Xext/xvmcext.h,v 1.1 2001/04/07 11:04:21 alanh Exp $ */ + +#ifndef _XVMC_H +#define _XVMC_H +#include "Xv.h" +#include "xvdix.h" + +typedef struct { + int num_xvimages; + int *xvimage_ids; +} XvMCImageIDList; + +typedef struct { + int surface_type_id; + int chroma_format; + int color_description; + unsigned short max_width; + unsigned short max_height; + unsigned short subpicture_max_width; + unsigned short subpicture_max_height; + int mc_type; + int flags; + XvMCImageIDList *compatible_subpictures; +} XvMCSurfaceInfoRec, *XvMCSurfaceInfoPtr; + +typedef struct { + XID context_id; + ScreenPtr pScreen; + int adapt_num; + int surface_type_id; + unsigned short width; + unsigned short height; + CARD32 flags; + int refcnt; + pointer port_priv; + pointer driver_priv; +} XvMCContextRec, *XvMCContextPtr; + +typedef struct { + XID surface_id; + int surface_type_id; + XvMCContextPtr context; + pointer driver_priv; +} XvMCSurfaceRec, *XvMCSurfacePtr; + + +typedef struct { + XID subpicture_id; + int xvimage_id; + unsigned short width; + unsigned short height; + int num_palette_entries; + int entry_bytes; + char component_order[4]; + XvMCContextPtr context; + pointer driver_priv; +} XvMCSubpictureRec, *XvMCSubpicturePtr; + +typedef int (*XvMCCreateContextProcPtr) ( + XvPortPtr port, + XvMCContextPtr context, + int *num_priv, + CARD32 **priv +); + +typedef void (*XvMCDestroyContextProcPtr) ( + XvMCContextPtr context +); + +typedef int (*XvMCCreateSurfaceProcPtr) ( + XvMCSurfacePtr surface, + int *num_priv, + CARD32 **priv +); + +typedef void (*XvMCDestroySurfaceProcPtr) ( + XvMCSurfacePtr surface +); + +typedef int (*XvMCCreateSubpictureProcPtr) ( + XvMCSubpicturePtr subpicture, + int *num_priv, + CARD32 **priv +); + +typedef void (*XvMCDestroySubpictureProcPtr) ( + XvMCSubpicturePtr subpicture +); + + +typedef struct { + XvAdaptorPtr xv_adaptor; + int num_surfaces; + XvMCSurfaceInfoPtr *surfaces; + int num_subpictures; + XvImagePtr *subpictures; + XvMCCreateContextProcPtr CreateContext; + XvMCDestroyContextProcPtr DestroyContext; + XvMCCreateSurfaceProcPtr CreateSurface; + XvMCDestroySurfaceProcPtr DestroySurface; + XvMCCreateSubpictureProcPtr CreateSubpicture; + XvMCDestroySubpictureProcPtr DestroySubpicture; +} XvMCAdaptorRec, *XvMCAdaptorPtr; + +void XvMCExtensionInit(void); + +int XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr adapt); + +#endif /* _XVMC_H */ diff --git a/xc/programs/Xserver/Xext/xvmodproc.h b/xc/programs/Xserver/Xext/xvmodproc.h index 82b890ede..2dcbd472a 100644 --- a/xc/programs/Xserver/Xext/xvmodproc.h +++ b/xc/programs/Xserver/Xext/xvmodproc.h @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/Xext/xvmodproc.h,v 1.2 2001/03/05 04:51:55 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xvmodproc.h,v 1.3 2001/04/08 16:33:22 dawes Exp $ */ -#include "xvmc.h" +#include "xvmcext.h" extern int (*XvGetScreenIndexProc)(void); extern unsigned long (*XvGetRTPortProc)(void); diff --git a/xc/programs/Xserver/Xprint/Imakefile b/xc/programs/Xserver/Xprint/Imakefile index 70f90fd66..ddc0bf244 100644 --- a/xc/programs/Xserver/Xprint/Imakefile +++ b/xc/programs/Xserver/Xprint/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:48:04 cpqbld Exp $ -XCOMM $XFree86: xc/programs/Xserver/Xprint/Imakefile,v 1.15 2001/01/17 22:36:28 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/Xprint/Imakefile,v 1.16 2001/04/20 15:51:16 tsi Exp $ #include <Server.tmpl> @@ -69,7 +69,6 @@ PSDIR = ps PSDEF = -DXPPSDDX #endif -OS_DEFINES = ServerOSDefines #if HasMkstemp MKTMP_DEFINES = -DHAS_MKSTEMP #endif diff --git a/xc/programs/Xserver/dix/gc.c b/xc/programs/Xserver/dix/gc.c index 310c7a1b8..0ae9962d1 100644 --- a/xc/programs/Xserver/dix/gc.c +++ b/xc/programs/Xserver/dix/gc.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/dix/gc.c,v 3.6 2001/01/17 22:36:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/dix/gc.c,v 3.7 2001/04/23 20:31:06 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -95,14 +95,16 @@ ValidateGC(pDraw, pGC) * or pUnion, but not both; one of them must be NULL. If you don't need * to pass any pointers, you can use either one: * - * /* example calling dixChangeGC using pC32 parameter + * example calling dixChangeGC using pC32 parameter + * * CARD32 v[2]; * v[0] = foreground; * v[1] = background; * dixChangeGC(client, pGC, GCForeground|GCBackground, v, NULL); * - * /* example calling dixChangeGC using pUnion parameter; - * /* same effect as above + * example calling dixChangeGC using pUnion parameter; + * same effect as above + * * ChangeGCVal v[2]; * v[0].val = foreground; * v[1].val = background; @@ -111,10 +113,12 @@ ValidateGC(pDraw, pGC) * However, if you need to pass a pointer to a pixmap or font, you MUST * use the pUnion parameter. * - * /* example calling dixChangeGC passing pointers in the value list + * example calling dixChangeGC passing pointers in the value list + * v[1].ptr is a pointer to a pixmap + * * ChangeGCVal v[2]; * v[0].val = FillTiled; - * v[1].ptr = pPixmap; /* pointer to a pixmap + * v[1].ptr = pPixmap; * dixChangeGC(client, pGC, GCFillStyle|GCTile, NULL, v); * * Note: we could have gotten by with just the pUnion parameter, but on diff --git a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/classes.nib b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/classes.nib index 3c4afe987..b5583719f 100644 --- a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/classes.nib +++ b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/classes.nib @@ -7,13 +7,16 @@ SUPERCLASS = NSObject; }, { - ACTIONS = {close = id; saveChanges = id; setKey = id; }; + ACTIONS = {close = id; pickFile = id; saveChanges = id; setKey = id; }; CLASS = Preferences; LANGUAGE = ObjC; OUTLETS = { displayNumber = id; fakeButton = id; keyField = id; + keymapFileField = id; + loadKeymapFileButton = id; + pickKeymapFileButton = id; splashStartupHelpButton = id; startupHelpButton = id; systemBeepButton = id; 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 index 7c8a23fe9..21d75f060 100644 --- 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 @@ -3,7 +3,7 @@ <plist version="0.9"> <dict> <key>IBDocumentLocation</key> - <string>11 9 367 304 0 4 800 574 </string> + <string>20 4 367 304 0 4 800 574 </string> <key>IBMainMenuLocation</key> <string>19 268 220 44 0 4 800 574 </string> <key>IBUserGuides</key> diff --git a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/objects.nib b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/objects.nib Binary files differindex 5a21abc46..39fec4b7a 100644 --- a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/objects.nib +++ b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/objects.nib diff --git a/xc/programs/Xserver/hw/darwin/bundle/Imakefile b/xc/programs/Xserver/hw/darwin/bundle/Imakefile index a8c0416ce..aaeed48a7 100644 --- a/xc/programs/Xserver/hw/darwin/bundle/Imakefile +++ b/xc/programs/Xserver/hw/darwin/bundle/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/darwin/bundle/Imakefile,v 1.7 2001/04/02 05:18:50 torrey Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/darwin/bundle/Imakefile,v 1.9 2001/04/18 20:28:52 torrey Exp $ #include <Server.tmpl> @@ -28,8 +28,12 @@ CUSTOMVERSION = XFree86CustomVersion CUSTOMVERDEF = -DXF86_CUSTOM_VERSION='$(CUSTOMVERSION)' #endif -DEFINES = $(CUSTOMVERDEF) -DXBINDIR=$(DESTDIR)$(BINDIR) -XDARWINBINDIR = $(DESTDIR)$(BINDIR)/XDarwin.app/Contents/MacOS +DEFINES = $(CUSTOMVERDEF) -DXBINDIR=$(DESTDIR)$(BINDIR) -DXINITDIR=$(XINITDIR) +#if NothingOutsideProjectRoot +XDARWINROOT = $(DESTDIR)$(BINDIR) +#else +XDARWINROOT = /Applications +#endif NormalLibraryObjectRule() NormalLibraryTarget(XQuartz,$(OBJS)) @@ -43,8 +47,12 @@ InstallProgram(XDarwinStartup,$(DESTDIR)$(BINDIR)) install:: -(cd $(DESTDIR)$(BINDIR); $(RM) X; $(LN) XDarwinStartup X) +AllTarget(XDarwin) +XDarwin: + pbxbuild -target XDarwin + install:: - pbxbuild install -target XDarwin DSTROOT=$(DESTDIR)$(BINDIR) + pbxbuild install -target XDarwin DSTROOT=$(XDARWINROOT) clean:: pbxbuild "clean" -target XDarwin diff --git a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/classes.nib b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/classes.nib index 3c4afe987..b5583719f 100644 --- a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/classes.nib +++ b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/classes.nib @@ -7,13 +7,16 @@ SUPERCLASS = NSObject; }, { - ACTIONS = {close = id; saveChanges = id; setKey = id; }; + ACTIONS = {close = id; pickFile = id; saveChanges = id; setKey = id; }; CLASS = Preferences; LANGUAGE = ObjC; OUTLETS = { displayNumber = id; fakeButton = id; keyField = id; + keymapFileField = id; + loadKeymapFileButton = id; + pickKeymapFileButton = id; splashStartupHelpButton = id; startupHelpButton = id; systemBeepButton = id; 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 index e2f8cf545..babc232fe 100644 --- 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 @@ -3,9 +3,9 @@ <plist version="0.9"> <dict> <key>IBDocumentLocation</key> - <string>14 4 367 304 0 4 800 574 </string> + <string>451 75 367 304 0 67 1024 679 </string> <key>IBMainMenuLocation</key> - <string>18 269 262 44 0 4 800 574 </string> + <string>78 473 262 44 0 4 800 574 </string> <key>IBUserGuides</key> <dict> <key>HelpPanel</key> diff --git a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/objects.nib b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/objects.nib Binary files differindex 1d79a36c7..0c990727b 100644 --- a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/objects.nib +++ b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/objects.nib diff --git a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/XDarwinHelp.html b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/XDarwinHelp.html index b4b1a4741..ff20e7208 100644 --- a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/XDarwinHelp.html +++ b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/XDarwinHelp.html @@ -1,4 +1,3 @@ -<!-- $XFree86: xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/XDarwinHelp.html,v 1.2 2001/04/05 06:08:47 torrey Exp $ --> <html> <head> <META http-equiv="Content-Type" content="text/html; charset=EUC-JP"> @@ -7,7 +6,7 @@ XFree86 for Mac OS X</title></head> <body> <center> <h1> -Darwin ¤È Mac OS X ¾å¤Î XFree86 +XFree86 on Darwin and Mac OS X </h1> </center> <h2> @@ -34,16 +33,16 @@ Darwin ¤È Mac OS X ¾å¤Î XFree86 </center> <blockquote> ¤³¤ì¤Ï¡¤XFree86 ¤Î¥×¥ì¥ê¥ê¡¼¥¹¥Ð¡¼¥¸¥ç¥ó¤Ç¤¢¤ê¡¤¤¤¤«¤Ê¤ë¾ì¹ç¤Ë¤ª¤¤¤Æ¤â¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó¡£ -ËÜ¥½¥Õ¥È¥¦¥§¥¢¤Ï¡¤<A HREF="#license">MIT X11/X Consortium License</A> ¤Î¾ò·ï¤Ë´ð¤Å¤¡¤ÊݾÚ̵¤·¤Ç¡¤¡Ö¤½¤Î¤Þ¤Þ¡×¤Î·Á¤Ç¶¡µë¤µ¤ì¤Þ¤¹¡£ -¤´»ÈÍѤˤʤëÁ°¤Ë¡¤<A HREF="#license">¥é¥¤¥»¥ó¥¹</A>¤òÆɤó¤Ç²¼¤µ¤¤¡£ +ËÜ¥½¥Õ¥È¥¦¥§¥¢¤Ï¡¤<A HREF="#license">MIT X11/X Consortium License</A> ¤Î¾ò·ï¤Ë´ð¤Å¤¡¤ÌµÊݾڤǡ¤¡Ö¤½¤Î¤Þ¤Þ¡×¤Î·Á¤Ç¶¡µë¤µ¤ì¤Þ¤¹¡£ +¤´»ÈÍѤˤʤëÁ°¤Ë¡¤<A HREF="#license">¥é¥¤¥»¥ó¥¹¾ò·ï</A>¤ò¤ªÆɤ߲¼¤µ¤¤¡£ ¥Ð¥°¤ÎÊó¹ð¤ä¥Ñ¥Ã¥Á¤¬ SourceForge ¤Î <A HREF="http://sourceforge.net/projects/xonx/">XonX ¥×¥í¥¸¥§¥¯¥È¥Ú¡¼¥¸</A>¤ËÄó½Ð¤µ¤ì¤Æ¤¤¤ë¤«¤â¤·¤ì¤Þ¤»¤ó¡£ -¥×¥ì¥ê¥ê¡¼¥¹¥Ð¡¼¥¸¥ç¥ó¤Î¥Ð¥°¤òÊó¹ð¤¹¤ëÁ°¤Ë¡¤<A HREF="http://sourceforge.net/projects/xonx/">XonX</A> ¥×¥í¥¸¥§¥¯¥È¥Ú¡¼¥¸¤Þ¤¿¤Ï <A HREF="http://www.XFree86.Org/cvs">XFree86 CVS ÁÒ¸Ë</A>¤ÇºÇ¿·ÈǤΥÁ¥§¥Ã¥¯¤ò¤·¤Æ²¼¤µ¤¤¡£ +¥×¥ì¥ê¥ê¡¼¥¹¥Ð¡¼¥¸¥ç¥ó¤Î¥Ð¥°¤òÊó¹ð¤¹¤ëÁ°¤Ë¡¤<A HREF="http://sourceforge.net/projects/xonx/">XonX</A> ¥×¥í¥¸¥§¥¯¥È¥Ú¡¼¥¸¤Þ¤¿¤Ï <A HREF="http://www.XFree86.Org/cvs">XFree86 CVS ¥ê¥Ý¥¸¥È¥ê</A>¤ÇºÇ¿·ÈǤΥÁ¥§¥Ã¥¯¤ò¤·¤Æ²¼¤µ¤¤¡£ </blockquote> <h2> <a NAME="usage">»ÈÍÑË¡</a> </h2> <p> -Mac OS X ¾å¤Ç¡¤XFree86¤Ï¥Õ¥ë¥¹¥¯¥ê¡¼¥ó¥â¡¼¥É¤ÇÆ°ºî¤·¤Þ¤¹¡£ +Mac OS X ¾å¤Ç¡¤XFree86 ¤Ï¥Õ¥ë¥¹¥¯¥ê¡¼¥ó¥â¡¼¥É¤ÇÆ°ºî¤·¤Þ¤¹¡£ X Window ¥Ç¥¹¥¯¥È¥Ã¥×¤¬¥¢¥¯¥Æ¥£¥Ö¤Ê»þ¡¤¤½¤ì¤ÏÁ´²èÌ̤òÀêͤ·¤Þ¤¹¡£ ¤¢¤Ê¤¿¤Ï¡¤Command-Option-A ¥¡¼¤ò²¡¤¹¤³¤È¤Ë¤è¤Ã¤Æ Mac OS X ¥Ç¥¹¥¯¥È¥Ã¥×¤ØÀÚ¤êÂؤ¨¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£ ¡Ê¤³¤Î¥¡¼¤ÎÁȤ߹ç¤ï¤»¤Ï¡¤´Ä¶ÀßÄê¤ÇÊѹ¹²Äǽ¤Ç¤¹¡Ë @@ -94,7 +93,7 @@ X11 ¤Î¥Þ¥Ë¥å¥¢¥ë¥Ú¡¼¥¸¤Ï /usr/X11R6/man ¤ËÃÖ¤«¤ì¤Þ¤¹¡£¤½¤·¤Æ MANPATH ´Ä¶ÊÑ¿ô¤Ï¸ <h2> <a NAME="license">¥é¥¤¥»¥ó¥¹</a> </h2> -XFree86 Project ¤Ï¡¤¼«Í³¤ËºÆÇÛÉÛ²Äǽ¤Ê¥Ð¥¤¥Ê¥ê¤È¥½¡¼¥¹¥³¡¼¥É¤òÄ󶡤¹¤ë¤³¤È¤òÌ󫤷¤Þ¤¹¡£ +XFree86 Project ¤Ï¡¤¼«Í³¤ËºÆÇÛÉÛ²Äǽ¤Ê¥Ð¥¤¥Ê¥ê¤È¥½¡¼¥¹¥³¡¼¥É¤òÄ󶡤¹¤ë¤³¤È¤Ë¥³¥ß¥Ã¥È¤·¤Æ¤¤¤Þ¤¹¡£ »ä¤¿¤Á¤¬»ÈÍѤ¹¤ë¼ç¤Ê¥é¥¤¥»¥ó¥¹¤Ï¡¤ÅÁÅýŪ¤Ê MIT X11/X Consortium License ¤Ë´ð¤Å¤¯¤â¤Î¤Ç¤¹¡£ ¤½¤·¤Æ¡¤¤½¤ì¤Ï½¤Àµ¤Þ¤¿¤ÏºÆÇÛÉÛ¤µ¤ì¤ë¥½¡¼¥¹¥³¡¼¥É¤Þ¤¿¤Ï¥Ð¥¤¥Ê¥ê¤Ë¡¤¤½¤Î Copyright/¥é¥¤¥»¥ó¥¹¹ð¼¨¤¬¤½¤Î¤Þ¤Þ»Ä¤µ¤ì¤ë¤³¤È¤òÍ׵᤹¤ë°Ê³°¤Î¾ò·ï¤ò¶¯À©¤·¤Þ¤»¤ó¡£ ¤è¤ê¿¤¯¤Î¾ðÊó¤È¡¤¥³¡¼¥É¤Î°ìÉô¤ò¥«¥Ð¡¼¤¹¤ëÄɲäΠCopyright/¥é¥¤¥»¥ó¥¹¹ð¼¨¤Î¤¿¤á¤Ë¡¤<A HREF="http://www.xfree86.org/legal/licence.html">XFree86 ¤Î License ¥Ú¡¼¥¸</A>¤ò»²¾È¤·¤Æ²¼¤µ¤¤¡£ diff --git a/xc/programs/Xserver/hw/darwin/bundle/Preferences.h b/xc/programs/Xserver/hw/darwin/bundle/Preferences.h index f2a6ba724..dd89f82aa 100644 --- a/xc/programs/Xserver/hw/darwin/bundle/Preferences.h +++ b/xc/programs/Xserver/hw/darwin/bundle/Preferences.h @@ -1,16 +1,19 @@ -/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/Preferences.h,v 1.2 2001/04/05 06:08:46 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/Preferences.h,v 1.4 2001/04/25 02:23:47 torrey Exp $ */ #import <Cocoa/Cocoa.h> @interface Preferences : NSObject { IBOutlet NSPanel *window; - IBOutlet id keyField; - IBOutlet id fakeButton; IBOutlet id displayNumber; + IBOutlet id fakeButton; + IBOutlet id keyField; + IBOutlet id keymapFileField; + IBOutlet id loadKeymapFileButton; + IBOutlet id pickKeymapFileButton; + IBOutlet id splashStartupHelpButton; IBOutlet id startupHelpButton; IBOutlet id systemBeepButton; - IBOutlet id splashStartupHelpButton; BOOL isGettingKeyCode; int keyCode; @@ -18,6 +21,7 @@ NSMutableString *switchString; } - (IBAction)close:(id)sender; +- (IBAction)pickFile:(id)sender; - (IBAction)saveChanges:(id)sender; - (IBAction)setKey:(id)sender; @@ -25,6 +29,8 @@ - (void)awakeFromNib; ++ (void)setUseKeymapFile:(BOOL)newUseKeymapFile; ++ (void)setKeymapFile:(NSString*)newFile; + (void)setSwitchString:(NSString*)newString; + (void)setKeyCode:(int)newKeyCode; + (void)setModifiers:(int)newModifiers; @@ -32,7 +38,10 @@ + (void)setFakeButtons:(BOOL)newFakeButtons; + (void)setStartupHelp:(BOOL)newStartupHelp; + (void)setSystemBeep:(BOOL)newSystemBeep; ++ (void)saveToDisk; ++ (BOOL)useKeymapFile; ++ (NSString*)keymapFile; + (NSString*)switchString; + (unsigned int)keyCode; + (unsigned int)modifiers; diff --git a/xc/programs/Xserver/hw/darwin/bundle/Preferences.m b/xc/programs/Xserver/hw/darwin/bundle/Preferences.m index 968f9aff7..f923b2224 100644 --- a/xc/programs/Xserver/hw/darwin/bundle/Preferences.m +++ b/xc/programs/Xserver/hw/darwin/bundle/Preferences.m @@ -3,7 +3,7 @@ // // This class keeps track of the user preferences. // -/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/Preferences.m,v 1.2 2001/04/05 06:08:46 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/Preferences.m,v 1.4 2001/04/25 02:23:47 torrey Exp $ */ #import "Preferences.h" #import "quartzShared.h" @@ -24,7 +24,7 @@ switchString=[[NSMutableString alloc] init]; // Provide user defaults if needed - if([[NSUserDefaults standardUserDefaults] stringForKey:@"SwitchKeyCode"]==nil) { + if ([[NSUserDefaults standardUserDefaults] stringForKey:@"SwitchKeyCode"] == nil) { [Preferences setKeyCode:0]; [Preferences setModifiers:(NSCommandKeyMask | NSAlternateKeyMask)]; [Preferences setSwitchString:@"Cmd-Opt-a"]; @@ -33,6 +33,10 @@ [Preferences setStartupHelp:YES]; [Preferences setSystemBeep:NO]; } + if ([[NSUserDefaults standardUserDefaults] stringForKey:@"UseKeymappingFile"] == nil) { + [Preferences setUseKeymapFile:NO]; + [Preferences setKeymapFile:@"/System/Library/Keyboards/USA.keymapping"]; + } [self initSwitchKey]; @@ -41,7 +45,18 @@ // Set the window controls to the state in user defaults - (void)resetWindow { - [keyField setTitle:[Preferences switchString]]; + [loadKeymapFileButton setIntValue:[Preferences useKeymapFile]]; + + if ([Preferences keymapFile] == nil) + [keymapFileField setStringValue:@" "]; + else + [keymapFileField setStringValue:[Preferences keymapFile]]; + + if ([Preferences switchString] == nil) + [keyField setTitle:@"--"]; + else + [keyField setTitle:[Preferences switchString]]; + [displayNumber setIntValue:[Preferences display]]; [fakeButton setIntValue:[Preferences fakeButtons]]; [startupHelpButton setIntValue:[Preferences startupHelp]]; @@ -61,20 +76,33 @@ [self initSwitchKey]; // reset switch key state } +// Pick keymapping file +- (IBAction)pickFile:(id)sender +{ + int result; + NSArray *fileTypes = [NSArray arrayWithObject:@"keymapping"]; + NSOpenPanel *oPanel = [NSOpenPanel openPanel]; + + [oPanel setAllowsMultipleSelection:NO]; + result = [oPanel runModalForDirectory:@"/System/Library/Keyboards" file:nil types:fileTypes]; + if (result == NSOKButton) { + [keymapFileField setStringValue:[oPanel filename]]; + } +} + // User saved changes - (IBAction)saveChanges:(id)sender { [Preferences setKeyCode:keyCode]; [Preferences setModifiers:modifiers]; [Preferences setSwitchString:switchString]; + [Preferences setKeymapFile:[keymapFileField stringValue]]; + [Preferences setUseKeymapFile:[loadKeymapFileButton intValue]]; [Preferences setDisplay:[displayNumber intValue]]; [Preferences setFakeButtons:[fakeButton intValue]]; [Preferences setStartupHelp:[startupHelpButton intValue]]; [Preferences setSystemBeep:[systemBeepButton intValue]]; - - // Update the settings used by the X server thread - quartzUseSysBeep = [Preferences systemBeep]; - darwinFakeButtons = [Preferences fakeButton]; + [Preferences saveToDisk]; [window orderOut:nil]; } @@ -118,6 +146,14 @@ return NO; } ++ (void)setKeymapFile:(NSString*)newFile { + [[NSUserDefaults standardUserDefaults] setObject:newFile forKey:@"KeymappingFile"]; +} + ++ (void)setUseKeymapFile:(BOOL)newUseKeymapFile { + [[NSUserDefaults standardUserDefaults] setBool:newUseKeymapFile forKey:@"UseKeymappingFile"]; +} + + (void)setSwitchString:(NSString*)newString { [[NSUserDefaults standardUserDefaults] setObject:newString forKey:@"SwitchString"]; } @@ -136,6 +172,8 @@ + (void)setFakeButtons:(BOOL)newFakeButtons { [[NSUserDefaults standardUserDefaults] setBool:newFakeButtons forKey:@"FakeButtons"]; + // Update the setting used by the X server thread + darwinFakeButtons = newFakeButtons; } + (void)setStartupHelp:(BOOL)newStartupHelp { @@ -144,6 +182,20 @@ + (void)setSystemBeep:(BOOL)newSystemBeep { [[NSUserDefaults standardUserDefaults] setBool:newSystemBeep forKey:@"UseSystemBeep"]; + // Update the setting used by the X server thread + quartzUseSysBeep = newSystemBeep; +} + ++ (void)saveToDisk { + [[NSUserDefaults standardUserDefaults] synchronize]; +} + ++ (BOOL)useKeymapFile { + return [[NSUserDefaults standardUserDefaults] boolForKey:@"UseKeymappingFile"]; +} + ++ (NSString*)keymapFile { + return [[NSUserDefaults standardUserDefaults] stringForKey:@"KeymappingFile"]; } + (NSString*)switchString { diff --git a/xc/programs/Xserver/hw/darwin/bundle/XDarwin.pbproj/project.pbxproj b/xc/programs/Xserver/hw/darwin/bundle/XDarwin.pbproj/project.pbxproj index 877e20104..4848d9c01 100644 --- a/xc/programs/Xserver/hw/darwin/bundle/XDarwin.pbproj/project.pbxproj +++ b/xc/programs/Xserver/hw/darwin/bundle/XDarwin.pbproj/project.pbxproj @@ -177,6 +177,7 @@ children = ( 018F40F3003E1916CE6F79C2, 021D6BA9003E1BACCE6F79C2, + 3E74E03600863F047F000001, 018F40F6003E1974CE6F79C2, ); isa = PBXGroup; @@ -250,6 +251,11 @@ path = English.lproj/XDarwinHelp.html; refType = 4; }; + 0338412F0083BFE57F000001 = { + isa = PBXFileReference; + path = quartzCursor.h; + refType = 4; + }; 04329610000763920A000002 = { isa = PBXFileReference; path = Preferences.m; @@ -645,6 +651,11 @@ path = quartzCursor.c; refType = 4; }; + 3E74E03600863F047F000001 = { + isa = PBXFileReference; + path = darwinClut8.h; + refType = 4; + }; 43B962CE00617089416877C2 = { children = ( 018F40F8003E1979CE6F79C2, @@ -652,6 +663,7 @@ 237A34C10076E37E7F000001, 237A34C40076F4F07F000001, 3576829A0077B8F17F000001, + 0338412F0083BFE57F000001, 43B962D000617089416877C2, 43B962CF00617089416877C2, 43B962D100617089416877C2, diff --git a/xc/programs/Xserver/hw/darwin/bundle/XDarwinStartup.c b/xc/programs/Xserver/hw/darwin/bundle/XDarwinStartup.c index f321cb0be..435c3cc77 100644 --- a/xc/programs/Xserver/hw/darwin/bundle/XDarwinStartup.c +++ b/xc/programs/Xserver/hw/darwin/bundle/XDarwinStartup.c @@ -4,18 +4,20 @@ * * This program selects the appropriate X server to launch: * XDarwin IOKit X server (default) - * XDarwin.app Quartz X server (-quartz option) + * XDarwinQuartz A soft link to the Quartz X server + * executable (-quartz option) * * If told to idle, the program will simply pause and not * launch any X server. This is to support startx being * run by XDarwin.app. * **************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/XDarwinStartup.c,v 1.1 2001/03/29 02:06:51 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/XDarwinStartup.c,v 1.3 2001/04/16 06:51:48 torrey Exp $ */ #include <unistd.h> #include <stdio.h> #include <stdlib.h> +#include <sys/syslimits.h> extern int errno; @@ -43,11 +45,23 @@ int main( return 0; } else if (!strcmp(argv[i], "-quartz")) { + char quartzPath[PATH_MAX+1]; + int pathLength; + + // Find the path to the Quartz executable + pathLength = readlink(XPATH(XDarwinQuartz), quartzPath, PATH_MAX); + if (!pathLength) { + fprintf(stderr, "The symbolic link " XPATH(XDarwinQuartz) + " is not valid.\n"); + return errno; + } + quartzPath[pathLength] = '\0'; + // Build the new argument list - newargv = (char **) malloc((argc+2) + sizeof(char *)); + newargv = (char **) malloc((argc+2) * sizeof(char *)); for (j = argc; j; j--) newargv[j] = argv[j]; - newargv[0] = XPATH(XDarwin.app/Contents/MacOS/XDarwin); + newargv[0] = quartzPath; newargv[argc] = "-nostartx"; newargv[argc+1] = NULL; @@ -58,7 +72,7 @@ int main( } // Build the new argument list - newargv = (char **) malloc((argc+1) + sizeof(char *)); + newargv = (char **) malloc((argc+1) * sizeof(char *)); for (j = argc; j; j--) newargv[j] = argv[j]; newargv[0] = XPATH(XDarwin); diff --git a/xc/programs/Xserver/hw/darwin/bundle/Xserver.h b/xc/programs/Xserver/hw/darwin/bundle/Xserver.h index 87d4ae09a..0e0ce6961 100644 --- a/xc/programs/Xserver/hw/darwin/bundle/Xserver.h +++ b/xc/programs/Xserver/hw/darwin/bundle/Xserver.h @@ -3,22 +3,26 @@ // // Created by Andreas Monitzer on January 6, 2001. // -/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/Xserver.h,v 1.4 2001/04/02 08:50:56 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/Xserver.h,v 1.6 2001/04/25 02:23:47 torrey Exp $ */ #import <Cocoa/Cocoa.h> #include <drivers/event_status_driver.h> // for NXEvent #include <unistd.h> -#include <stdlib.h> +#include <stdio.h> +#include <sys/syslimits.h> @interface Xserver : NSObject { // server state NSLock *serverLock; + NSTask *clientTask; + NSPort *signalPort; + NSPortMessage *signalMessage; BOOL serverVisible; BOOL appQuitting; UInt32 mouseState; - // communication + // server event queue int eventWriteFD; // Aqua interface @@ -34,24 +38,27 @@ + (void)append:(NSString*)value toEnv:(NSString*)name; - (void)run; -- (void)startClients; - (void)toggle; - (void)show; - (void)hide; -- (void)kill; +- (void)killServer; - (void)readPasteboard; - (void)writePasteboard; +- (void)clientTaskDone:(NSNotification *)aNotification; - (void)sendNXEvent:(NXEvent*)ev; - (void)sendShowHide:(BOOL)show; - (IBAction)closeHelpAndShow:(id)sender; // NSApplication delegate -- (BOOL)applicationShouldTerminate:(NSApplication *)sender; +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; - (void)applicationDidFinishLaunching:(NSNotification *)aNotification; - (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag; - (void)applicationWillResignActive:(NSNotification *)aNotification; - (void)applicationWillBecomeActive:(NSNotification *)aNotification; +// NSPort delegate +- (void)handlePortMessage:(NSPortMessage *)portMessage; + @end diff --git a/xc/programs/Xserver/hw/darwin/bundle/Xserver.m b/xc/programs/Xserver/hw/darwin/bundle/Xserver.m index e0f86790f..d047b53dd 100644 --- a/xc/programs/Xserver/hw/darwin/bundle/Xserver.m +++ b/xc/programs/Xserver/hw/darwin/bundle/Xserver.m @@ -6,7 +6,7 @@ // // Created by Andreas Monitzer on January 6, 2001. // -/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/Xserver.m,v 1.7 2001/04/05 06:08:46 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/Xserver.m,v 1.14 2001/04/25 02:23:47 torrey Exp $ */ #import "Xserver.h" #import "Preferences.h" @@ -23,6 +23,9 @@ extern int argcGlobal; extern char **argvGlobal; extern char **envpGlobal; +extern int main(int argc, char *argv[], char *envp[]); +extern void HideMenuBar(void); +extern void ShowMenuBar(void); @implementation Xserver @@ -30,39 +33,52 @@ extern char **envpGlobal; self=[super init]; serverLock = [[NSLock alloc] init]; + clientTask = nil; serverVisible = NO; appQuitting = NO; mouseState = 0; eventWriteFD = quartzEventWriteFD; + // set up a port to safely send messages to main thread from server thread + signalPort = [[NSPort port] retain]; + signalMessage = [[NSPortMessage alloc] initWithSendPort:signalPort receivePort:signalPort components:nil]; + + // set up receiving end + [signalPort setDelegate:self]; + [[NSRunLoop currentRunLoop] addPort:signalPort forMode:NSDefaultRunLoopMode]; + [[NSRunLoop currentRunLoop] addPort:signalPort forMode:NSModalPanelRunLoopMode]; + return self; } -- (BOOL)applicationShouldTerminate:(NSApplication *)sender { - int but; - +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { + // Quit if the X server is not running if ([serverLock tryLock]) - return YES; - if (serverVisible) - [self hide]; + return NSTerminateNow; - but = NSRunAlertPanel(NSLocalizedString(@"Quit X server?",@""), - NSLocalizedString(@"Quitting the X server will terminate any running X Window programs.",@""), - NSLocalizedString(@"Quit",@""), - NSLocalizedString(@"Cancel",@""), - nil); - - switch (but) { - case NSAlertDefaultReturn: // quit - appQuitting = YES; - [self kill]; - // Try to wait until the X server shuts down - [serverLock lockBeforeDate:[NSDate dateWithTimeIntervalSinceNow:10]]; - return YES; - case NSAlertAlternateReturn: // cancel - break; + if ([clientTask isRunning] || !quartzStartClients) { + int but; + + [self hide]; + but = NSRunAlertPanel(NSLocalizedString(@"Quit X server?",@""), + NSLocalizedString(@"Quitting the X server will terminate any running X Window programs.",@""), + NSLocalizedString(@"Quit",@""), + NSLocalizedString(@"Cancel",@""), + nil); + + switch (but) { + case NSAlertDefaultReturn: // quit + break; + case NSAlertAlternateReturn: // cancel + return NSTerminateCancel; + } } - return NO; + + appQuitting = YES; + [self killServer]; + + // Wait until the X server shuts down + return NSTerminateLater; } // returns YES when event was handled @@ -75,10 +91,10 @@ extern char **envpGlobal; [self toggle]; return YES; } - + if(!serverVisible) return NO; - + [self getNXMouse:&ev]; ev.type=[anEvent type]; ev.flags=[anEvent modifierFlags]; @@ -89,13 +105,14 @@ extern char **envpGlobal; break; case NSLeftMouseDragged: case NSRightMouseDragged: + case 27: // undocumented high button MouseDragged event ev.type=NSMouseMoved; break; case NSSystemDefined: if(([anEvent subtype]==7) && ([anEvent data1] & 1)) - return YES; // skip mouse button 1 events + return NO; // skip mouse button 1 events if(mouseState==[anEvent data2]) - return YES; // ignore double events + return NO; // ignore double events ev.data.compound.subType=[anEvent subtype]; ev.data.compound.misc.L[0]=[anEvent data1]; ev.data.compound.misc.L[1]=mouseState=[anEvent data2]; @@ -112,7 +129,7 @@ extern char **envpGlobal; ev.data.key.keyCode = [anEvent keyCode]; break; default: - return YES; + return NO; } [self sendNXEvent:&ev]; @@ -137,18 +154,64 @@ extern char **envpGlobal; // Start the X server thread [NSThread detachNewThreadSelector:@selector(run) toTarget:self withObject:nil]; + // If we are going to display a splash screen, hide the X11 screen immediately + if ([Preferences startupHelp]) + [self sendShowHide:NO]; + // Start the X clients if started from GUI - if (quartzStartClients) - [NSThread detachNewThreadSelector:@selector(startClients) toTarget:self withObject:nil]; + if (quartzStartClients) { + char *home; + char xinitrcbuf[PATH_MAX]; + NSString *path = [NSString stringWithCString:XPATH(xinit)]; + NSString *server = [NSString stringWithCString:XPATH(XDarwinStartup)]; + NSString *client; + BOOL hasClient = YES; + NSArray *args; + + // Register to receive notification when the client task finishes + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(clientTaskDone:) + name:NSTaskDidTerminateNotification + object:nil]; + + // Change to user's home directory (so xterms etc. start there) + home = getenv("HOME"); + if (home) + chdir(home); + else + home = ""; + + // Add X binary directory to path + [Xserver append:@":" toEnv:@"PATH"]; + [Xserver append:@XSTRPATH(XBINDIR) toEnv:@"PATH"]; + + // Find the client init file to use + snprintf(xinitrcbuf, PATH_MAX, "%s/.xinitrc", home); + if (access(xinitrcbuf, F_OK)) { + snprintf(xinitrcbuf, PATH_MAX, XSTRPATH(XINITDIR) "/xinitrc"); + if (access(xinitrcbuf, F_OK)) { + hasClient = NO; + } + } + if (hasClient) { + client = [NSString stringWithCString:xinitrcbuf]; + args = [NSArray arrayWithObjects:client, @"--", server, @"-idle", nil]; + } else { + args = [NSArray arrayWithObjects:@"--", server, @"-idle", nil]; + } + + // Launch a new task to run start X clients + clientTask = [NSTask launchedTaskWithLaunchPath:path arguments:args]; + } // Make sure the menu bar gets drawn [NSApp setWindowsNeedUpdate:YES]; // Display the help splash screen or show the X server if ([Preferences startupHelp]) { - [self sendShowHide:NO]; [helpWindow makeKeyAndOrderFront:self]; } else { + ShowMenuBar(); [self closeHelpAndShow:self]; } } @@ -162,24 +225,7 @@ extern char **envpGlobal; serverVisible = NO; [serverLock unlock]; [pool release]; - if (!appQuitting) - [NSApp terminate:nil]; // quit if we aren't already -} - -// Start the X clients in a separate thread -- (void)startClients { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - char *home; - - // Change to user's home directory (so xterms etc. start there) - home = getenv("HOME"); - if (home) chdir(home); - - [Xserver append:@":" toEnv:@"PATH"]; - [Xserver append:@XSTRPATH(XBINDIR) toEnv:@"PATH"]; - system(XPATH(startx -- -idle &)); - // FIXME: quit when startx dies - [pool release]; + [signalMessage sendBeforeDate:[NSDate distantPast]]; } // Close the help splash screen and show the X server @@ -188,7 +234,10 @@ extern char **envpGlobal; helpVal = [startupHelpButton intValue]; [Preferences setStartupHelp:helpVal]; + [Preferences saveToDisk]; + [helpWindow close]; + serverVisible = YES; [self sendShowHide:YES]; [NSApp activateIgnoringOtherApps:YES]; @@ -216,8 +265,8 @@ extern char **envpGlobal; } } -// Kill the Xserver process -- (void)kill { +// Kill the Xserver thread +- (void)killServer { NXEvent ev; if (serverVisible) @@ -239,6 +288,7 @@ extern char **envpGlobal; if (show) { ev.data.compound.subType = kXDarwinShow; [self sendNXEvent:&ev]; + HideMenuBar(); // inform the X server of the current modifier state ev.flags = [[NSApp currentEvent] modifierFlags]; @@ -253,6 +303,7 @@ extern char **envpGlobal; ev.data.compound.subType = kXDarwinHide; [self sendNXEvent:&ev]; + ShowMenuBar(); } serverVisible = show; @@ -281,10 +332,38 @@ extern char **envpGlobal; - (void)sendNXEvent:(NXEvent*)ev { if (write(eventWriteFD, ev, sizeof(*ev)) == sizeof(*ev)) return; - ErrorF("Bad write to event pipe.\n"); + NSLog(@"Bad write to event pipe."); // FIXME: handle bad writes better? } +// Handle message that X server thread is finished +- (void)handlePortMessage:(NSPortMessage *)portMessage { + if (appQuitting) { + // If we quit before the clients start, they may sit and wait + // for the X server to start. Kill them instead. + if ([clientTask isRunning]) + [clientTask terminate]; + [NSApp replyToApplicationShouldTerminate:YES]; + } else { + [NSApp terminate:nil]; // quit if we aren't already + } +} + +// Quit the X server when the X client task finishes +- (void)clientTaskDone:(NSNotification *)aNotification { + // Make sure it was the client task that finished + if (![clientTask isRunning]) { + int status = [[aNotification object] terminationStatus]; + + if (status != 0) + NSLog(@"X client task terminated abnormally."); + + if (!appQuitting) + [NSApp terminate:nil]; // quit if we aren't already + } +} + +// Called when the user clicks the application icon, but not when Cmd-Tab is used - (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag { [self show]; return NO; diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartz.c b/xc/programs/Xserver/hw/darwin/bundle/quartz.c index f3965d55e..080937288 100644 --- a/xc/programs/Xserver/hw/darwin/bundle/quartz.c +++ b/xc/programs/Xserver/hw/darwin/bundle/quartz.c @@ -5,7 +5,7 @@ * By Gregory Robert Parker * **************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartz.c,v 1.4 2001/04/02 05:18:50 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartz.c,v 1.7 2001/04/16 06:51:48 torrey Exp $ */ // X headers #include "scrnintstr.h" @@ -25,6 +25,7 @@ #include "../darwin.h" #include "quartz.h" #include "quartzAudio.h" +#include "quartzCursor.h" #define kDarwinMaxScreens 100 static ScreenPtr darwinScreens[kDarwinMaxScreens]; @@ -112,31 +113,24 @@ Bool QuartzAddScreen(ScreenPtr pScreen) /* * QuartzCapture - * Capture the screen so we can draw and hide the Aqua cursor. + * Capture the screen so we can draw. */ static void QuartzCapture(void) { if (! CGDisplayIsCaptured(kCGDirectMainDisplay)) { CGDisplayCapture(kCGDirectMainDisplay); -// FIXME: Properly initialize X cursor -#if 0 - CGDisplayHideCursor(kCGDirectMainDisplay); -#endif - HideMenuBar(); } } /* * QuartzRelease - * Release the screen so others can draw and restore the Aqua cursor. + * Release the screen so others can draw. */ static void QuartzRelease(void) { if (CGDisplayIsCaptured(kCGDirectMainDisplay)) { - InitCursor(); CGDisplayRelease(kCGDirectMainDisplay); - ShowMenuBar(); } } @@ -174,10 +168,12 @@ static void QuartzDisplayInit(void) /* * QuartzOsVendorInit - * Quartz display initialization. + * Quartz display initialization. */ void QuartzOsVendorInit(void) { + ErrorF("Display mode: Quartz\n"); + QuartzAudioInit(); QuartzDisplayInit(); } @@ -185,27 +181,34 @@ void QuartzOsVendorInit(void) /* * QuartzShow - * Show the X server on screen. Does nothing if already shown. - * recapture the screen, restore the X clip regions. + * Show the X server on screen. Does nothing if already shown. + * Recapture the screen, restore the X clip regions, and restore + * the X server cursor state. */ -void QuartzShow(void) { +void QuartzShow( + int x, // cursor location + int y ) +{ int i; QuartzCapture(); if (xhidden) { for (i = 0; i < darwinNumScreens; i++) { - if (darwinScreens[i]) - xf86SetRootClip(darwinScreens[i], true); + if (darwinScreens[i]) { + xf86SetRootClip(darwinScreens[i], true); + QuartzResumeXCursor(darwinScreens[i], x, y); + } } } - xhidden = false; + xhidden = FALSE; } /* * QuartzHide * Remove the X server display from the screen. Does nothing if already hidden. - * Release the screen, set X clip regions to prevent drawing. + * Release the screen, set X clip regions to prevent drawing, and restore the + * Aqua cursor. */ void QuartzHide(void) { @@ -213,12 +216,14 @@ void QuartzHide(void) if (!xhidden) { for (i = 0; i < darwinNumScreens; i++) { - if (darwinScreens[i]) - xf86SetRootClip(darwinScreens[i], false); + if (darwinScreens[i]) { + QuartzSuspendXCursor(darwinScreens[i]); + xf86SetRootClip(darwinScreens[i], false); + } } } QuartzRelease(); - xhidden = true; + xhidden = TRUE; } diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartz.h b/xc/programs/Xserver/hw/darwin/bundle/quartz.h index 01c52eaae..30839fcda 100644 --- a/xc/programs/Xserver/hw/darwin/bundle/quartz.h +++ b/xc/programs/Xserver/hw/darwin/bundle/quartz.h @@ -3,7 +3,7 @@ Quartz-specific functions and definitions */ -/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartz.h,v 1.2 2001/04/02 05:18:50 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartz.h,v 1.3 2001/04/11 08:34:18 torrey Exp $ */ #ifndef _QUARTZ_H #define _QUARTZ_H @@ -15,9 +15,8 @@ void QuartzOsVendorInit(void); Bool QuartzAddScreen(ScreenPtr screen); -Bool QuartzInitCursor(ScreenPtr pScreen); void QuartzGiveUp(void); void QuartzHide(void); -void QuartzShow(void); +void QuartzShow(int x, int y); #endif diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzAudio.c b/xc/programs/Xserver/hw/darwin/bundle/quartzAudio.c index a794a2b35..d903b24df 100644 --- a/xc/programs/Xserver/hw/darwin/bundle/quartzAudio.c +++ b/xc/programs/Xserver/hw/darwin/bundle/quartzAudio.c @@ -10,7 +10,7 @@ // Smoothing transitions between sounds // http://www.wam.umd.edu/~mphoenix/dss/dss.html // -/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzAudio.c,v 1.2 2001/04/05 06:08:46 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzAudio.c,v 1.3 2001/04/07 18:01:29 torrey Exp $ */ #include <CoreAudio/AudioHardware.h> #include <pthread.h> @@ -238,10 +238,9 @@ void QuartzBell( return; } - // FIXME: how is NSBeep volume set? if (quartzUseSysBeep) { - NSBeep(); - return; + if (volume) + NSBeep(); } else { QuartzCoreAudioBell(volume, pitch, duration); } diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzCocoa.m b/xc/programs/Xserver/hw/darwin/bundle/quartzCocoa.m index d9168df75..c7b108646 100644 --- a/xc/programs/Xserver/hw/darwin/bundle/quartzCocoa.m +++ b/xc/programs/Xserver/hw/darwin/bundle/quartzCocoa.m @@ -7,26 +7,36 @@ * that use X include files to avoid symbol collisions. * **************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzCocoa.m,v 1.2 2001/04/05 06:08:46 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzCocoa.m,v 1.4 2001/04/25 02:23:47 torrey Exp $ */ #include <Cocoa/Cocoa.h> #import "Preferences.h" #include "quartzShared.h" -static NSArray *pasteboardTypes = nil; +extern void FatalError(const char *, ...); // Read the user preferences from the Cocoa front end void QuartzReadPreferences(void) { + char *fileString; + darwinFakeButtons = [Preferences fakeButtons]; quartzUseSysBeep = [Preferences systemBeep]; + if ([Preferences useKeymapFile]) { + fileString = [[Preferences keymapFile] lossyCString]; + darwinKeymapFile = (char *) malloc(strlen(fileString)+1); + if (! darwinKeymapFile) + FatalError("malloc failed in QuartzReadPreferences()!\n"); + strcpy(darwinKeymapFile, fileString); + } } // Write text to the Mac OS X pasteboard. void QuartzWriteCocoaPasteboard(char *text) { NSPasteboard *pasteboard; + NSArray *pasteboardTypes; NSString *string; if (! text) return; @@ -34,15 +44,11 @@ void QuartzWriteCocoaPasteboard(char *text) if (! pasteboard) return; string = [NSString stringWithCString:text]; if (! string) return; - if (! pasteboardTypes) { - pasteboardTypes = [NSArray arrayWithObject:NSStringPboardType]; - [pasteboardTypes retain]; - } + pasteboardTypes = [NSArray arrayWithObject:NSStringPboardType]; // nil owner because we don't provide type translations [pasteboard declareTypes:pasteboardTypes owner:nil]; [pasteboard setString:string forType:NSStringPboardType]; - [string release]; } // Read text from the Mac OS X pasteboard and return it as a heap string. @@ -50,14 +56,11 @@ void QuartzWriteCocoaPasteboard(char *text) char *QuartzReadCocoaPasteboard(void) { NSPasteboard *pasteboard; + NSArray *pasteboardTypes; NSString *existingType; char *text = NULL; - if (! pasteboardTypes) { - pasteboardTypes = [NSArray arrayWithObject:NSStringPboardType]; - [[pasteboardTypes retain] autorelease]; - } - + pasteboardTypes = [NSArray arrayWithObject:NSStringPboardType]; pasteboard = [NSPasteboard generalPasteboard]; if (! pasteboard) return NULL; @@ -68,10 +71,9 @@ char *QuartzReadCocoaPasteboard(void) if (! string) return NULL; buffer = [string lossyCString]; - text = (char *) malloc(strlen(buffer)); + text = (char *) malloc(strlen(buffer)+1); if (text) strcpy(text, buffer); - [string release]; } return text; diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzCursor.c b/xc/programs/Xserver/hw/darwin/bundle/quartzCursor.c index 9435d96e9..d53cea982 100644 --- a/xc/programs/Xserver/hw/darwin/bundle/quartzCursor.c +++ b/xc/programs/Xserver/hw/darwin/bundle/quartzCursor.c @@ -3,13 +3,15 @@ * Support for using the Quartz Window Manager cursor * **************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzCursor.c,v 1.1 2001/04/02 05:18:50 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzCursor.c,v 1.3 2001/04/13 20:55:26 torrey Exp $ */ #include "mi.h" #include "scrnintstr.h" #include "cursorstr.h" #include "mipointrst.h" +#include "quartzCursor.h" + #undef AllocCursor #define Cursor QD_Cursor #define WindowPtr QD_WindowPtr @@ -20,13 +22,179 @@ #define CURSORHEIGHT 16 typedef struct { - int cursorMode; + int qdCursorMode; + int qdCursorVisible; + int serverVisible; + CursorPtr latentCursor; QueryBestSizeProcPtr QueryBestSize; miPointerSpriteFuncPtr spriteFuncs; } QuartzCursorScreenRec, *QuartzCursorScreenPtr; static int darwinCursorScreenIndex = -1; static unsigned long darwinCursorGeneration = 0; +static QD_Cursor gQDArrow; // QuickDraw arrow cursor + +#define CURSOR_PRIV(pScreen) \ + ((QuartzCursorScreenPtr)pScreen->devPrivates[darwinCursorScreenIndex].ptr) +#define HIDE_QD_CURSOR(display, visible) \ + if (visible) { CGDisplayHideCursor(display); visible = FALSE; } +#define SHOW_QD_CURSOR(display, visible) \ + if (! visible) { CGDisplayShowCursor(display); visible = TRUE; } + + +/* + * MakeQDCursor helpers: CTAB_ENTER, interleave + */ + +// Add a color entry to a ctab +#define CTAB_ENTER(ctab, index, r, g, b) \ + ctab->ctTable[index].rgb.red = r; \ + ctab->ctTable[index].rgb.green = g; \ + ctab->ctTable[index].rgb.blue = b + +// Make an unsigned short by interleaving the bits of bytes c1 and c2. +// High bit of c1 is first; low bit of c2 is last. +// Interleave is a built-in INTERCAL operator. +static unsigned short +interleave( + unsigned char c1, + unsigned char c2 ) +{ + return + ((c1 & 0x80) << 8) | ((c2 & 0x80) << 7) | + ((c1 & 0x40) << 7) | ((c2 & 0x40) << 6) | + ((c1 & 0x20) << 6) | ((c2 & 0x20) << 5) | + ((c1 & 0x10) << 5) | ((c2 & 0x10) << 4) | + ((c1 & 0x08) << 4) | ((c2 & 0x08) << 3) | + ((c1 & 0x04) << 3) | ((c2 & 0x04) << 2) | + ((c1 & 0x02) << 2) | ((c2 & 0x02) << 1) | + ((c1 & 0x01) << 1) | ((c2 & 0x01) << 0) ; +} + +/* + * MakeQDCursor + * Make a QuickDraw color cursor from the given X11 cursor. + * Warning: This code is nasty. Color cursors were meant to be read + * from resources; constructing the structures programmatically is messy. + */ +/* + QuickDraw cursor representation: + Our color cursor is a 2 bit per pixel pixmap. + Each pixel's bits are (source<<1 | mask) from the original X cursor pixel. + The cursor's color table maps the colors like this: + (2-bit value | X result | colortable | Mac result) + 00 | transparent | white | transparent (white outside mask) + 01 | back color | back color | back color + 10 | undefined | black | invert background (just for fun) + 11 | fore color | fore color | fore color +*/ +static CCrsrHandle +MakeQDCursor( + CursorPtr pCursor ) +{ + CCrsrHandle result; + CCrsrPtr curs; + int i, w, h; + unsigned short rowMask; + PixMap *pix; + ColorTable *ctab; + unsigned short *image; + + result = (CCrsrHandle) NewHandleClear(sizeof(CCrsr)); + if (!result) return NULL; + HLock((Handle)result); + curs = *result; + + // Initialize CCrsr + curs->crsrType = 0x8001; // 0x8000 = b&w, 0x8001 = color + curs->crsrMap = (PixMapHandle) NewHandleClear(sizeof(PixMap)); + if (!curs->crsrMap) goto pixAllocFailed; + HLock((Handle)curs->crsrMap); + pix = *curs->crsrMap; + curs->crsrData = NULL; // raw cursor image data (set below) + curs->crsrXData = NULL; // QD's processed data + curs->crsrXValid = 0; // zero means QD must re-process cursor data + curs->crsrXHandle = NULL; // reserved + memset(curs->crsr1Data, 0, CURSORWIDTH*CURSORHEIGHT/8); // b&w data + memset(curs->crsrMask, 0, CURSORWIDTH*CURSORHEIGHT/8); // b&w & color mask + curs->crsrHotSpot.h = min(CURSORWIDTH, pCursor->bits->xhot); // hot spot + curs->crsrHotSpot.v = min(CURSORHEIGHT, pCursor->bits->yhot); // hot spot + curs->crsrXTable = 0; // reserved + curs->crsrID = GetCTSeed(); // unique ID from Color Manager + + // Set the b&w data and mask + w = min(pCursor->bits->width, CURSORWIDTH); + h = min(pCursor->bits->height, CURSORHEIGHT); + rowMask = ~((1 << (CURSORWIDTH - w)) - 1); + for (i = 0; i < h; i++) { + curs->crsr1Data[i] = rowMask & + ((pCursor->bits->source[i*4]<<8) | pCursor->bits->source[i*4+1]); + curs->crsrMask[i] = rowMask & + ((pCursor->bits->mask[i*4]<<8) | pCursor->bits->mask[i*4+1]); + } + + // Set the color data and mask + // crsrMap: defines bit depth and size and colortable only + pix->rowBytes = (CURSORWIDTH * 2 / 8) | 0x8000; // last bit on means PixMap + SetRect(&pix->bounds, 0, 0, CURSORWIDTH, CURSORHEIGHT); // see TN 1020 + pix->pixelSize = 2; + pix->cmpCount = 1; + pix->cmpSize = 2; + // pix->pmTable set below + + // crsrData is the pixel data. crsrMap's baseAddr is not used. + curs->crsrData = NewHandleClear(CURSORWIDTH*CURSORHEIGHT * 2 / 8); + if (!curs->crsrData) goto imageAllocFailed; + HLock((Handle)curs->crsrData); + image = (unsigned short *) *curs->crsrData; + // Pixel data is just 1-bit data and mask interleaved (see above) + for (i = 0; i < h; i++) { + unsigned char s, m; + s = pCursor->bits->source[i*4] & (rowMask >> 8); + m = pCursor->bits->mask[i*4] & (rowMask >> 8); + image[2*i] = interleave(s, m); + s = pCursor->bits->source[i*4+1] & (rowMask & 0x00ff); + m = pCursor->bits->mask[i*4+1] & (rowMask & 0x00ff); + image[2*i+1] = interleave(s, m); + } + + // Build the color table (entries described above) + // NewPixMap allocates a color table handle. + pix->pmTable = (CTabHandle) NewHandleClear(sizeof(ColorTable) + 3 + * sizeof(ColorSpec)); + if (!pix->pmTable) goto ctabAllocFailed; + HLock((Handle)pix->pmTable); + ctab = *pix->pmTable; + ctab->ctSeed = GetCTSeed(); + ctab->ctFlags = 0; + ctab->ctSize = 3; // color count - 1 + CTAB_ENTER(ctab, 0, 0xffff, 0xffff, 0xffff); + CTAB_ENTER(ctab, 1, pCursor->backRed, pCursor->backGreen, + pCursor->backBlue); + CTAB_ENTER(ctab, 2, 0x0000, 0x0000, 0x0000); + CTAB_ENTER(ctab, 3, pCursor->foreRed, pCursor->foreGreen, + pCursor->foreBlue); + + HUnlock((Handle)pix->pmTable); // ctab + HUnlock((Handle)curs->crsrData); // image data + HUnlock((Handle)curs->crsrMap); // pix + HUnlock((Handle)result); // cursor + + return result; + + // "What we have here is a failure to allocate" +ctabAllocFailed: + HUnlock((Handle)curs->crsrData); + DisposeHandle((Handle)curs->crsrData); +imageAllocFailed: + HUnlock((Handle)curs->crsrMap); + DisposeHandle((Handle)curs->crsrMap); +pixAllocFailed: + HUnlock((Handle)result); + DisposeHandle((Handle)result); + return NULL; +} + /* =========================================================================== @@ -45,10 +213,8 @@ QuartzRealizeCursor( ScreenPtr pScreen, CursorPtr pCursor ) { - int i; - QD_Cursor *curs; - QuartzCursorScreenPtr ScreenPriv = (QuartzCursorScreenPtr) - pScreen->devPrivates[darwinCursorScreenIndex].ptr; + CCrsrHandle qdCursor; + QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); if(!pCursor || !pCursor->bits) return FALSE; @@ -58,29 +224,13 @@ QuartzRealizeCursor( (pCursor->bits->width > CURSORWIDTH)) return (*ScreenPriv->spriteFuncs->RealizeCursor)(pScreen, pCursor); - // allocate memory for new cursor image - curs = xalloc( sizeof(QD_Cursor) ); - if (!curs) - return FALSE; - - // X cursor max size is 32x32 (rowbytes 4). - // Copy top left 16x16 for now. - for (i = 0; i < 16; i++) - { - curs->data[i] = (pCursor->bits->source[i*4]<<8) | - pCursor->bits->source[i*4+1]; - curs->mask[i] = (pCursor->bits->mask[i*4]<<8) | - pCursor->bits->mask[i*4+1]; - } - curs->hotSpot.h = pCursor->bits->xhot; - if(curs->hotSpot.h >= 16) - curs->hotSpot.h = 15; - curs->hotSpot.v = pCursor->bits->yhot; - if(curs->hotSpot.v >= 16) - curs->hotSpot.v = 15; + // make new cursor image + qdCursor = MakeQDCursor(pCursor); + if (!qdCursor) return FALSE; // save the result - pCursor->devPriv[pScreen->myNum] = (pointer) curs; + pCursor->devPriv[pScreen->myNum] = (pointer) qdCursor; + return TRUE; } @@ -94,14 +244,13 @@ QuartzUnrealizeCursor( ScreenPtr pScreen, CursorPtr pCursor ) { - QuartzCursorScreenPtr ScreenPriv = (QuartzCursorScreenPtr) - pScreen->devPrivates[darwinCursorScreenIndex].ptr; + QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); if ((pCursor->bits->height > CURSORHEIGHT) || (pCursor->bits->width > CURSORWIDTH)) { return (*ScreenPriv->spriteFuncs->UnrealizeCursor)(pScreen, pCursor); } else { - xfree( pCursor->devPriv[pScreen->myNum] ); + DisposeCCursor((CCrsrHandle) pCursor->devPriv[pScreen->myNum]); return TRUE; } } @@ -119,40 +268,40 @@ QuartzSetCursor( int x, int y) { - QD_Cursor *curs; - QuartzCursorScreenPtr ScreenPriv = (QuartzCursorScreenPtr) - pScreen->devPrivates[darwinCursorScreenIndex].ptr; + QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); + + ScreenPriv->latentCursor = pCursor; + + // Don't touch Mac OS cursor if X is hidden! + if (! ScreenPriv->serverVisible) + return; - // are we supposed to remove the cursor? if (!pCursor) { - if (ScreenPriv->cursorMode == 0) + // Remove the cursor completely. + HIDE_QD_CURSOR(kCGDirectMainDisplay, ScreenPriv->qdCursorVisible); + if (! ScreenPriv->qdCursorMode) (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y); - else - CGDisplayHideCursor(kCGDirectMainDisplay); - return; } + else if ((pCursor->bits->height <= CURSORHEIGHT) && + (pCursor->bits->width <= CURSORWIDTH)) + { + // Cursor is small enough to use QuickDraw directly. + CCrsrHandle curs; - // can we use QuickDraw cursor? - if ((pCursor->bits->height <= CURSORHEIGHT) && - (pCursor->bits->width <= CURSORWIDTH)) { - - if (ScreenPriv->cursorMode == 0) // remove the X cursor + if (! ScreenPriv->qdCursorMode) // remove the X cursor (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y); + ScreenPriv->qdCursorMode = TRUE; - ScreenPriv->cursorMode = 1; - curs = (QD_Cursor *) pCursor->devPriv[pScreen->myNum]; - SetCursor(curs); - return; + curs = (CCrsrHandle) pCursor->devPriv[pScreen->myNum]; + SetCCursor(curs); + SHOW_QD_CURSOR(kCGDirectMainDisplay, ScreenPriv->qdCursorVisible); } - - // otherwise we use a software cursor - if (ScreenPriv->cursorMode) { - // remove the QuickDraw cursor - QuartzSetCursor(pScreen, 0, x, y); + else { + // Cursor is too big for QuickDraw. Use X software cursor. + HIDE_QD_CURSOR(kCGDirectMainDisplay, ScreenPriv->qdCursorVisible); + ScreenPriv->qdCursorMode = FALSE; + (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, pCursor, x, y); } - - ScreenPriv->cursorMode = 0; - (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, pCursor, x, y); } @@ -166,11 +315,10 @@ QuartzMoveCursor( int x, int y) { - QuartzCursorScreenPtr ScreenPriv = (QuartzCursorScreenPtr) - pScreen->devPrivates[darwinCursorScreenIndex].ptr; + QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); // only the X cursor needs to be explicitly moved - if (!ScreenPriv->cursorMode) + if (!ScreenPriv->qdCursorMode) (*ScreenPriv->spriteFuncs->MoveCursor)(pScreen, x, y); } @@ -220,12 +368,24 @@ QuartzWarpCursor( { CGDisplayErr cgErr; CGPoint cgPoint; + int neverMoved = TRUE; - cgPoint = CGPointMake(x, y); - cgErr = CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgPoint); - if (cgErr != CGDisplayNoErr) { - ErrorF("Could not set cursor position with error code 0x%x.\n", cgErr); + if (neverMoved) { + // Don't move the cursor the first time. This is the jump-to-center + // initialization, and it's annoying because we may still be in MacOS. + neverMoved = FALSE; + return; + } + + if (CURSOR_PRIV(pScreen)->serverVisible) { + cgPoint = CGPointMake(x, y); + cgErr = CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgPoint); + if (cgErr != CGDisplayNoErr) { + ErrorF("Could not set cursor position with error code 0x%x.\n", + cgErr); + } } + miPointerWarpCursor(pScreen, x, y); } @@ -255,14 +415,14 @@ QuartzCursorQueryBestSize( unsigned short *height, ScreenPtr pScreen) { - QuartzCursorScreenPtr ScreenPriv = (QuartzCursorScreenPtr) - pScreen->devPrivates[darwinCursorScreenIndex].ptr; + QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); if (class == CursorShape) { *width = CURSORWIDTH; *height = CURSORHEIGHT; - } else + } else { (*ScreenPriv->QueryBestSize)(class, width, height, pScreen); + } } @@ -272,10 +432,10 @@ QuartzCursorQueryBestSize( */ Bool QuartzInitCursor( - ScreenPtr pScreen ) + ScreenPtr pScreen ) { QuartzCursorScreenPtr ScreenPriv; - miPointerScreenPtr PointPriv; + miPointerScreenPtr PointPriv; // initialize software cursor handling (always needed as backup) if (!miDCInitialize(pScreen, &quartzScreenFuncsRec)) { @@ -286,25 +446,56 @@ QuartzInitCursor( if (darwinCursorGeneration != serverGeneration) { if ((darwinCursorScreenIndex = AllocateScreenPrivateIndex()) < 0) return FALSE; - darwinCursorGeneration = serverGeneration; + darwinCursorGeneration = serverGeneration; } ScreenPriv = xcalloc( 1, sizeof(QuartzCursorScreenRec) ); if (!ScreenPriv) return FALSE; - pScreen->devPrivates[darwinCursorScreenIndex].ptr = (pointer) ScreenPriv; + CURSOR_PRIV(pScreen) = ScreenPriv; // override some screen procedures ScreenPriv->QueryBestSize = pScreen->QueryBestSize; pScreen->QueryBestSize = QuartzCursorQueryBestSize; // initialize QuickDraw cursor handling + GetQDGlobalsArrow(&gQDArrow); PointPriv = (miPointerScreenPtr) pScreen->devPrivates[miPointerScreenIndex].ptr; ScreenPriv->spriteFuncs = PointPriv->spriteFuncs; PointPriv->spriteFuncs = &quartzSpriteFuncsRec; - ScreenPriv->cursorMode = 1; + ScreenPriv->qdCursorMode = TRUE; + ScreenPriv->qdCursorVisible = TRUE; + ScreenPriv->latentCursor = NULL; + ScreenPriv->serverVisible = FALSE; return TRUE; } + + +// X server is hiding. Restore the Aqua cursor. +void QuartzSuspendXCursor( + ScreenPtr pScreen ) +{ + QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); + + SetCursor(&gQDArrow); + SHOW_QD_CURSOR(kCGDirectMainDisplay, ScreenPriv->qdCursorVisible); + + ScreenPriv->serverVisible = FALSE; +} + + +// X server is showing. Restore the X cursor. +void QuartzResumeXCursor( + ScreenPtr pScreen, + int x, + int y ) +{ + QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); + + ScreenPriv->serverVisible = TRUE; + + QuartzSetCursor(pScreen, ScreenPriv->latentCursor, x, y); +} diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzCursor.h b/xc/programs/Xserver/hw/darwin/bundle/quartzCursor.h new file mode 100644 index 000000000..997e26176 --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/bundle/quartzCursor.h @@ -0,0 +1,15 @@ +/* + * quartzCursor.h + * + * Quartz hardware cursor + */ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzCursor.h,v 1.1 2001/04/11 08:34:18 torrey Exp $ */ + +#ifndef QUARTZCURSOR_H +#define QUARTZCURSOR_H + +Bool QuartzInitCursor(ScreenPtr pScreen); +void QuartzSuspendXCursor(ScreenPtr pScreen); +void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y); + +#endif diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzShared.h b/xc/programs/Xserver/hw/darwin/bundle/quartzShared.h index 9a69295ce..3813f4f17 100644 --- a/xc/programs/Xserver/hw/darwin/bundle/quartzShared.h +++ b/xc/programs/Xserver/hw/darwin/bundle/quartzShared.h @@ -2,7 +2,7 @@ * Shared definitions between the Darwin X Server * and the Cocoa front end. */ -/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzShared.h,v 1.3 2001/04/05 06:08:46 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzShared.h,v 1.4 2001/04/25 02:23:47 torrey Exp $ */ #ifndef _QUARTZSHARED_H #define _QUARTZSHARED_H @@ -14,6 +14,7 @@ extern int quartzStartClients; // User preferences used by X server extern int quartzUseSysBeep; extern int darwinFakeButtons; +extern char *darwinKeymapFile; void QuartzReadPreferences(void); diff --git a/xc/programs/Xserver/hw/darwin/darwin.c b/xc/programs/Xserver/hw/darwin/darwin.c index fe019c3e1..10def7319 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.17 2001/04/05 06:08:45 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/darwin.c,v 1.21 2001/04/25 02:23:47 torrey Exp $ */ #include "X.h" #include "Xproto.h" @@ -17,10 +17,13 @@ #include "mipointer.h" #include "micmap.h" #include "site.h" +#include "globals.h" #include "xf86Version.h" #include <sys/types.h> #include <sys/time.h> +#include <sys/syslimits.h> +#include <stdio.h> #include <fcntl.h> #define NO_CFPLUGIN @@ -29,6 +32,7 @@ #include <IOKit/hidsystem/ev_keymap.h> #include "darwin.h" +#include "darwinClut8.h" #include "bundle/quartz.h" #include "xfIOKit.h" @@ -44,6 +48,7 @@ UInt32 darwinDesiredWidth = 0, darwinDesiredHeight = 0; IOIndex darwinDesiredDepth = -1; 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. @@ -108,9 +113,6 @@ DarwinPrintBanner() #if defined(BUILDERSTRING) ErrorF("%s \n",BUILDERSTRING); #endif -#if defined(DARWIN_WITH_QUARTZ) - ErrorF("Mac OS X Quartz support available.\n"); -#endif } @@ -138,8 +140,9 @@ static Bool DarwinAddScreen( int argc, char **argv ) { - int bitsPerRGB, i; + int bitsPerRGB, i, dpi; VisualPtr visual; + ColormapPtr pmap; /* Communicate the information about our initialized screen back to X. */ bitsPerRGB = dfb.pixelInfo.bitsPerComponent; @@ -170,11 +173,15 @@ static Bool DarwinAddScreen( // machine independent screen init // setup _Screen structure in pScreen + if (monitorResolution) + dpi = monitorResolution; + else + dpi = 75; if ( dfb.bitsPerPixel == 32 ) { if (!cfb32ScreenInit(pScreen, dfb.framebuffer, dfb.width, dfb.height, - 75, 75, /* screen size in dpi, which we have no accurate knowledge of */ + dpi, dpi, dfb.pitch / (dfb.bitsPerPixel/8))) { return FALSE; } @@ -182,7 +189,7 @@ static Bool DarwinAddScreen( if (!cfb16ScreenInit(pScreen, dfb.framebuffer, dfb.width, dfb.height, - 75, 75, /* screen size in dpi, which we have no accurate knowledge of */ + dpi, dpi, dfb.pitch / (dfb.bitsPerPixel/8))) { return FALSE; } @@ -190,7 +197,7 @@ static Bool DarwinAddScreen( if (!cfbScreenInit(pScreen, dfb.framebuffer, dfb.width, dfb.height, - 75, 75, /* screen size in dpi, which we have no accurate knowledge of */ + dpi, dpi, dfb.pitch / (dfb.bitsPerPixel/8))) { return FALSE; } @@ -198,8 +205,7 @@ static Bool DarwinAddScreen( return FALSE; } - // set the RGB order correctly for TrueColor, it is byte swapped by X - // FIXME: make work on x86 darwin if it ever gets buildable + // set the RGB order correctly for TrueColor if (dfb.bitsPerPixel > 8) { for (i = 0, visual = pScreen->visuals; // someday we may have more than 1 i < pScreen->numVisuals; i++, visual++) { @@ -244,13 +250,28 @@ static Bool DarwinAddScreen( return FALSE; } + /* Set the colormap to the statically defined one if we're in 8 bit + * 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) ) { + pmap = miInstalledMaps[pScreen->myNum]; + visual = pmap->pVisual; + for( i = 0; i < visual->ColormapEntries; i++ ) { + pmap->red[i].co.local.red = darwinClut8[i].red; + pmap->red[i].co.local.green = darwinClut8[i].green; + pmap->red[i].co.local.blue = darwinClut8[i].blue; + } + } + return TRUE; } /* ============================================================================= - mouse callbacks + mouse and keyboard callbacks ============================================================================= */ @@ -290,9 +311,11 @@ static int DarwinMouseProc( case DEVICE_INIT: pPointer->public.on = FALSE; + // Set button map. Darwin uses 2 for right and 3 for center. + // Reverse these to correspond to typical X usage. map[1] = 1; - map[2] = 2; - map[3] = 3; + map[2] = 3; + map[3] = 2; map[4] = 4; map[5] = 5; InitPointerDeviceStruct( (DevicePtr)pPointer, @@ -346,6 +369,69 @@ static int DarwinKeybdProc( DeviceIntPtr pDev, int onoff ) } /* +=========================================================================== + + Utility routines + +=========================================================================== +*/ + +/* + * DarwinFindLibraryFile + * Search for a file in the standard Library paths, which are (in order): + * + * ~/Library/ user specific + * /Library/ host specific + * /Network/Library/ LAN specific + * /System/Library/ OS specific + * + * A sub-path can be specified to search in below the various Library + * directories. Returns a new character string (owned by the caller) + * containing the full path to the first file found. + */ +static char * DarwinFindLibraryFile( + const char *file, + const char *pathext ) +{ + // Library search paths + char *pathList[] = { + "", + "/Network", + "/System", + NULL + }; + char *home; + char *fullPath; + int i = 0; + + // Return the file name as is if it is already a fully qualified path. + if (!access(file, F_OK)) { + fullPath = xalloc(strlen(file)+1); + strcpy(fullPath, file); + return fullPath; + } + + fullPath = xalloc(PATH_MAX); + + home = getenv("HOME"); + if (home) { + snprintf(fullPath, PATH_MAX, "%s/Library/%s/%s", home, pathext, file); + if (!access(fullPath, F_OK)) + return fullPath; + } + + while (pathList[i]) { + snprintf(fullPath, PATH_MAX, "%s/Library/%s/%s", pathList[i++], + pathext, file); + if (!access(fullPath, F_OK)) + return fullPath; + } + + xfree(fullPath); + return NULL; +} + +/* * 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 @@ -355,7 +441,7 @@ static int DarwinKeybdProc( DeviceIntPtr pDev, int onoff ) * closest to what the user wants. Ie. the user typically wants to * simulate a button 2 press instead of Command-button 2. */ -void DarwinSimulateMouseClick( +static void DarwinSimulateMouseClick( xEvent xe, // event template with time and // mouse position filled in int whichButton, // mouse button to be pressed @@ -393,7 +479,7 @@ void DarwinSimulateMouseClick( * DarwinUpdateModifiers * Send events to update the modifier state. */ -void DarwinUpdateModifiers( +static void DarwinUpdateModifiers( xEvent xe, // event template with time, mouse position, // and KeyPress or KeyRelease filled in int flags ) // modifier flags that have changed @@ -503,8 +589,13 @@ void ProcessInputEvents(void) (darwinPointer->public.processInputProc) ( &xe, darwinPointer, 1 ); break; - + +#ifdef __i386__ + // x86 drivers currently reverse mouse up and down + case NX_LMOUSEUP: +#else case NX_LMOUSEDOWN: +#endif // Mimic multi-button mouse with Command and Option if (darwinFakeButtons && ev.flags & (NX_COMMANDMASK | NX_ALTERNATEMASK)) { @@ -527,7 +618,11 @@ void ProcessInputEvents(void) } 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)) { @@ -628,9 +723,15 @@ void ProcessInputEvents(void) if (hwDelta & (1 << i)) { xe.u.u.detail = i + 1; if (hwButtons & (1 << i)) { +#ifdef __i386__ + xe.u.u.type = ButtonRelease; + } else { + xe.u.u.type = ButtonPress; +#else xe.u.u.type = ButtonPress; } else { xe.u.u.type = ButtonRelease; +#endif } (darwinPointer->public.processInputProc) ( &xe, darwinPointer, 1 ); @@ -660,12 +761,12 @@ void ProcessInputEvents(void) } break; } - + // Special events for Quartz support case NX_APPDEFINED: if (quartz) { switch (ev.data.compound.subType) { - + // Update modifier state. As opposed to NX_FLAGSCHANGED, // in this case any amount of modifiers may have changed. case kXDarwinUpdateModifiers: @@ -674,16 +775,20 @@ void ProcessInputEvents(void) xe.u.u.type = KeyPress; DarwinUpdateModifiers(xe, ~old_state & ev.flags); old_state = ev.flags; - break; - + break; + case kXDarwinShow: - QuartzShow(); + QuartzShow(ev.location.x, ev.location.y); + // The mouse location will have moved; track it. + xe.u.u.type = MotionNotify; + (darwinPointer->public.processInputProc) + ( &xe, darwinPointer, 1 ); break; - + case kXDarwinHide: QuartzHide(); break; - + case kXDarwinQuit: GiveUp(0); break; @@ -701,7 +806,7 @@ void ProcessInputEvents(void) } // switch (ev.data.compound.subType) } // if (quartz) break; - + default: ErrorF("Unknown event caught: %d\n", ev.type); ErrorF("\tev.type = %d\n", ev.type); @@ -816,6 +921,17 @@ int ddxProcessArgument( int argc, char *argv[], int i ) return 1; } + if ( !strcmp( argv[i], "-keymap" ) ) { + if ( i == argc-1 ) { + FatalError( "-keymap must be followed by a filename\n" ); + } + 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; @@ -909,7 +1025,8 @@ 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("-version : show the server version\n"); + ErrorF("-keymap <file> : read the keymapping from a file instead of the kernel.\n"); + ErrorF("-version : show the server version.\n"); #ifdef DARWIN_WITH_QUARTZ ErrorF("-quartz : run in parallel with Mac OS X Quartz window server.\n"); ErrorF("\n"); diff --git a/xc/programs/Xserver/hw/darwin/darwinClut8.h b/xc/programs/Xserver/hw/darwin/darwinClut8.h new file mode 100644 index 000000000..5ee8fa73e --- /dev/null +++ b/xc/programs/Xserver/hw/darwin/darwinClut8.h @@ -0,0 +1 @@ +/*
* Darwin default 8-bit Colormap for StaticColor
*/
/* $XFree86: xc/programs/Xserver/hw/darwin/darwinClut8.h,v 1.1 2001/04/12 20:09:53 torrey Exp $ */
#ifndef _DARWIN_CLUT8_
#define _DARWIN_CLUT8_
static xColorItem darwinClut8[] = {
{ 0, 0x0000, 0x0000, 0x0000, 0, 0 },
{ 1, 0xffff, 0xffff, 0xcccc, 0, 0 },
{ 2, 0xffff, 0xffff, 0x9999, 0, 0 },
{ 3, 0xffff, 0xffff, 0x6666, 0, 0 },
{ 4, 0xffff, 0xffff, 0x3333, 0, 0 },
{ 5, 0xffff, 0xffff, 0x0000, 0, 0 },
{ 6, 0xffff, 0xcccc, 0xffff, 0, 0 },
{ 7, 0xffff, 0xcccc, 0xcccc, 0, 0 },
{ 8, 0xffff, 0xcccc, 0x9999, 0, 0 },
{ 9, 0xffff, 0xcccc, 0x6666, 0, 0 },
{ 10, 0xffff, 0xcccc, 0x3333, 0, 0 },
{ 11, 0xffff, 0xcccc, 0x0000, 0, 0 },
{ 12, 0xffff, 0x9999, 0xffff, 0, 0 },
{ 13, 0xffff, 0x9999, 0xcccc, 0, 0 },
{ 14, 0xffff, 0x9999, 0x9999, 0, 0 },
{ 15, 0xffff, 0x9999, 0x6666, 0, 0 },
{ 16, 0xffff, 0x9999, 0x3333, 0, 0 },
{ 17, 0xffff, 0x9999, 0x0000, 0, 0 },
{ 18, 0xffff, 0x6666, 0xffff, 0, 0 },
{ 19, 0xffff, 0x6666, 0xcccc, 0, 0 },
{ 20, 0xffff, 0x6666, 0x9999, 0, 0 },
{ 21, 0xffff, 0x6666, 0x6666, 0, 0 },
{ 22, 0xffff, 0x6666, 0x3333, 0, 0 },
{ 23, 0xffff, 0x6666, 0x0000, 0, 0 },
{ 24, 0xffff, 0x3333, 0xffff, 0, 0 },
{ 25, 0xffff, 0x3333, 0xcccc, 0, 0 },
{ 26, 0xffff, 0x3333, 0x9999, 0, 0 },
{ 27, 0xffff, 0x3333, 0x6666, 0, 0 },
{ 28, 0xffff, 0x3333, 0x3333, 0, 0 },
{ 29, 0xffff, 0x3333, 0x0000, 0, 0 },
{ 30, 0xffff, 0x0000, 0xffff, 0, 0 },
{ 31, 0xffff, 0x0000, 0xcccc, 0, 0 },
{ 32, 0xffff, 0x0000, 0x9999, 0, 0 },
{ 33, 0xffff, 0x0000, 0x6666, 0, 0 },
{ 34, 0xffff, 0x0000, 0x3333, 0, 0 },
{ 35, 0xffff, 0x0000, 0x0000, 0, 0 },
{ 36, 0xcccc, 0xffff, 0xffff, 0, 0 },
{ 37, 0xcccc, 0xffff, 0xcccc, 0, 0 },
{ 38, 0xcccc, 0xffff, 0x9999, 0, 0 },
{ 39, 0xcccc, 0xffff, 0x6666, 0, 0 },
{ 40, 0xcccc, 0xffff, 0x3333, 0, 0 },
{ 41, 0xcccc, 0xffff, 0x0000, 0, 0 },
{ 42, 0xcccc, 0xcccc, 0xffff, 0, 0 },
{ 43, 0xcccc, 0xcccc, 0xcccc, 0, 0 },
{ 44, 0xcccc, 0xcccc, 0x9999, 0, 0 },
{ 45, 0xcccc, 0xcccc, 0x6666, 0, 0 },
{ 46, 0xcccc, 0xcccc, 0x3333, 0, 0 },
{ 47, 0xcccc, 0xcccc, 0x0000, 0, 0 },
{ 48, 0xcccc, 0x9999, 0xffff, 0, 0 },
{ 49, 0xcccc, 0x9999, 0xcccc, 0, 0 },
{ 50, 0xcccc, 0x9999, 0x9999, 0, 0 },
{ 51, 0xcccc, 0x9999, 0x6666, 0, 0 },
{ 52, 0xcccc, 0x9999, 0x3333, 0, 0 },
{ 53, 0xcccc, 0x9999, 0x0000, 0, 0 },
{ 54, 0xcccc, 0x6666, 0xffff, 0, 0 },
{ 55, 0xcccc, 0x6666, 0xcccc, 0, 0 },
{ 56, 0xcccc, 0x6666, 0x9999, 0, 0 },
{ 57, 0xcccc, 0x6666, 0x6666, 0, 0 },
{ 58, 0xcccc, 0x6666, 0x3333, 0, 0 },
{ 59, 0xcccc, 0x6666, 0x0000, 0, 0 },
{ 60, 0xcccc, 0x3333, 0xffff, 0, 0 },
{ 61, 0xcccc, 0x3333, 0xcccc, 0, 0 },
{ 62, 0xcccc, 0x3333, 0x9999, 0, 0 },
{ 63, 0xcccc, 0x3333, 0x6666, 0, 0 },
{ 64, 0xcccc, 0x3333, 0x3333, 0, 0 },
{ 65, 0xcccc, 0x3333, 0x0000, 0, 0 },
{ 66, 0xcccc, 0x0000, 0xffff, 0, 0 },
{ 67, 0xcccc, 0x0000, 0xcccc, 0, 0 },
{ 68, 0xcccc, 0x0000, 0x9999, 0, 0 },
{ 69, 0xcccc, 0x0000, 0x6666, 0, 0 },
{ 70, 0xcccc, 0x0000, 0x3333, 0, 0 },
{ 71, 0xcccc, 0x0000, 0x0000, 0, 0 },
{ 72, 0x9999, 0xffff, 0xffff, 0, 0 },
{ 73, 0x9999, 0xffff, 0xcccc, 0, 0 },
{ 74, 0x9999, 0xffff, 0x9999, 0, 0 },
{ 75, 0x9999, 0xffff, 0x6666, 0, 0 },
{ 76, 0x9999, 0xffff, 0x3333, 0, 0 },
{ 77, 0x9999, 0xffff, 0x0000, 0, 0 },
{ 78, 0x9999, 0xcccc, 0xffff, 0, 0 },
{ 79, 0x9999, 0xcccc, 0xcccc, 0, 0 },
{ 80, 0x9999, 0xcccc, 0x9999, 0, 0 },
{ 81, 0x9999, 0xcccc, 0x6666, 0, 0 },
{ 82, 0x9999, 0xcccc, 0x3333, 0, 0 },
{ 83, 0x9999, 0xcccc, 0x0000, 0, 0 },
{ 84, 0x9999, 0x9999, 0xffff, 0, 0 },
{ 85, 0x9999, 0x9999, 0xcccc, 0, 0 },
{ 86, 0x9999, 0x9999, 0x9999, 0, 0 },
{ 87, 0x9999, 0x9999, 0x6666, 0, 0 },
{ 88, 0x9999, 0x9999, 0x3333, 0, 0 },
{ 89, 0x9999, 0x9999, 0x0000, 0, 0 },
{ 90, 0x9999, 0x6666, 0xffff, 0, 0 },
{ 91, 0x9999, 0x6666, 0xcccc, 0, 0 },
{ 92, 0x9999, 0x6666, 0x9999, 0, 0 },
{ 93, 0x9999, 0x6666, 0x6666, 0, 0 },
{ 94, 0x9999, 0x6666, 0x3333, 0, 0 },
{ 95, 0x9999, 0x6666, 0x0000, 0, 0 },
{ 96, 0x9999, 0x3333, 0xffff, 0, 0 },
{ 97, 0x9999, 0x3333, 0xcccc, 0, 0 },
{ 98, 0x9999, 0x3333, 0x9999, 0, 0 },
{ 99, 0x9999, 0x3333, 0x6666, 0, 0 },
{ 100, 0x9999, 0x3333, 0x3333, 0, 0 },
{ 101, 0x9999, 0x3333, 0x0000, 0, 0 },
{ 102, 0x9999, 0x0000, 0xffff, 0, 0 },
{ 103, 0x9999, 0x0000, 0xcccc, 0, 0 },
{ 104, 0x9999, 0x0000, 0x9999, 0, 0 },
{ 105, 0x9999, 0x0000, 0x6666, 0, 0 },
{ 106, 0x9999, 0x0000, 0x3333, 0, 0 },
{ 107, 0x9999, 0x0000, 0x0000, 0, 0 },
{ 108, 0x6666, 0xffff, 0xffff, 0, 0 },
{ 109, 0x6666, 0xffff, 0xcccc, 0, 0 },
{ 110, 0x6666, 0xffff, 0x9999, 0, 0 },
{ 111, 0x6666, 0xffff, 0x6666, 0, 0 },
{ 112, 0x6666, 0xffff, 0x3333, 0, 0 },
{ 113, 0x6666, 0xffff, 0x0000, 0, 0 },
{ 114, 0x6666, 0xcccc, 0xffff, 0, 0 },
{ 115, 0x6666, 0xcccc, 0xcccc, 0, 0 },
{ 116, 0x6666, 0xcccc, 0x9999, 0, 0 },
{ 117, 0x6666, 0xcccc, 0x6666, 0, 0 },
{ 118, 0x6666, 0xcccc, 0x3333, 0, 0 },
{ 119, 0x6666, 0xcccc, 0x0000, 0, 0 },
{ 120, 0x6666, 0x9999, 0xffff, 0, 0 },
{ 121, 0x6666, 0x9999, 0xcccc, 0, 0 },
{ 122, 0x6666, 0x9999, 0x9999, 0, 0 },
{ 123, 0x6666, 0x9999, 0x6666, 0, 0 },
{ 124, 0x6666, 0x9999, 0x3333, 0, 0 },
{ 125, 0x6666, 0x9999, 0x0000, 0, 0 },
{ 126, 0x6666, 0x6666, 0xffff, 0, 0 },
{ 127, 0x6666, 0x6666, 0xcccc, 0, 0 },
{ 128, 0x6666, 0x6666, 0x9999, 0, 0 },
{ 129, 0x6666, 0x6666, 0x6666, 0, 0 },
{ 130, 0x6666, 0x6666, 0x3333, 0, 0 },
{ 131, 0x6666, 0x6666, 0x0000, 0, 0 },
{ 132, 0x6666, 0x3333, 0xffff, 0, 0 },
{ 133, 0x6666, 0x3333, 0xcccc, 0, 0 },
{ 134, 0x6666, 0x3333, 0x9999, 0, 0 },
{ 135, 0x6666, 0x3333, 0x6666, 0, 0 },
{ 136, 0x6666, 0x3333, 0x3333, 0, 0 },
{ 137, 0x6666, 0x3333, 0x0000, 0, 0 },
{ 138, 0x6666, 0x0000, 0xffff, 0, 0 },
{ 139, 0x6666, 0x0000, 0xcccc, 0, 0 },
{ 140, 0x6666, 0x0000, 0x9999, 0, 0 },
{ 141, 0x6666, 0x0000, 0x6666, 0, 0 },
{ 142, 0x6666, 0x0000, 0x3333, 0, 0 },
{ 143, 0x6666, 0x0000, 0x0000, 0, 0 },
{ 144, 0x3333, 0xffff, 0xffff, 0, 0 },
{ 145, 0x3333, 0xffff, 0xcccc, 0, 0 },
{ 146, 0x3333, 0xffff, 0x9999, 0, 0 },
{ 147, 0x3333, 0xffff, 0x6666, 0, 0 },
{ 148, 0x3333, 0xffff, 0x3333, 0, 0 },
{ 149, 0x3333, 0xffff, 0x0000, 0, 0 },
{ 150, 0x3333, 0xcccc, 0xffff, 0, 0 },
{ 151, 0x3333, 0xcccc, 0xcccc, 0, 0 },
{ 152, 0x3333, 0xcccc, 0x9999, 0, 0 },
{ 153, 0x3333, 0xcccc, 0x6666, 0, 0 },
{ 154, 0x3333, 0xcccc, 0x3333, 0, 0 },
{ 155, 0x3333, 0xcccc, 0x0000, 0, 0 },
{ 156, 0x3333, 0x9999, 0xffff, 0, 0 },
{ 157, 0x3333, 0x9999, 0xcccc, 0, 0 },
{ 158, 0x3333, 0x9999, 0x9999, 0, 0 },
{ 159, 0x3333, 0x9999, 0x6666, 0, 0 },
{ 160, 0x3333, 0x9999, 0x3333, 0, 0 },
{ 161, 0x3333, 0x9999, 0x0000, 0, 0 },
{ 162, 0x3333, 0x6666, 0xffff, 0, 0 },
{ 163, 0x3333, 0x6666, 0xcccc, 0, 0 },
{ 164, 0x3333, 0x6666, 0x9999, 0, 0 },
{ 165, 0x3333, 0x6666, 0x6666, 0, 0 },
{ 166, 0x3333, 0x6666, 0x3333, 0, 0 },
{ 167, 0x3333, 0x6666, 0x0000, 0, 0 },
{ 168, 0x3333, 0x3333, 0xffff, 0, 0 },
{ 169, 0x3333, 0x3333, 0xcccc, 0, 0 },
{ 170, 0x3333, 0x3333, 0x9999, 0, 0 },
{ 171, 0x3333, 0x3333, 0x6666, 0, 0 },
{ 172, 0x3333, 0x3333, 0x3333, 0, 0 },
{ 173, 0x3333, 0x3333, 0x0000, 0, 0 },
{ 174, 0x3333, 0x0000, 0xffff, 0, 0 },
{ 175, 0x3333, 0x0000, 0xcccc, 0, 0 },
{ 176, 0x3333, 0x0000, 0x9999, 0, 0 },
{ 177, 0x3333, 0x0000, 0x6666, 0, 0 },
{ 178, 0x3333, 0x0000, 0x3333, 0, 0 },
{ 179, 0x3333, 0x0000, 0x0000, 0, 0 },
{ 180, 0x0000, 0xffff, 0xffff, 0, 0 },
{ 181, 0x0000, 0xffff, 0xcccc, 0, 0 },
{ 182, 0x0000, 0xffff, 0x9999, 0, 0 },
{ 183, 0x0000, 0xffff, 0x6666, 0, 0 },
{ 184, 0x0000, 0xffff, 0x3333, 0, 0 },
{ 185, 0x0000, 0xffff, 0x0000, 0, 0 },
{ 186, 0x0000, 0xcccc, 0xffff, 0, 0 },
{ 187, 0x0000, 0xcccc, 0xcccc, 0, 0 },
{ 188, 0x0000, 0xcccc, 0x9999, 0, 0 },
{ 189, 0x0000, 0xcccc, 0x6666, 0, 0 },
{ 190, 0x0000, 0xcccc, 0x3333, 0, 0 },
{ 191, 0x0000, 0xcccc, 0x0000, 0, 0 },
{ 192, 0x0000, 0x9999, 0xffff, 0, 0 },
{ 193, 0x0000, 0x9999, 0xcccc, 0, 0 },
{ 194, 0x0000, 0x9999, 0x9999, 0, 0 },
{ 195, 0x0000, 0x9999, 0x6666, 0, 0 },
{ 196, 0x0000, 0x9999, 0x3333, 0, 0 },
{ 197, 0x0000, 0x9999, 0x0000, 0, 0 },
{ 198, 0x0000, 0x6666, 0xffff, 0, 0 },
{ 199, 0x0000, 0x6666, 0xcccc, 0, 0 },
{ 200, 0x0000, 0x6666, 0x9999, 0, 0 },
{ 201, 0x0000, 0x6666, 0x6666, 0, 0 },
{ 202, 0x0000, 0x6666, 0x3333, 0, 0 },
{ 203, 0x0000, 0x6666, 0x0000, 0, 0 },
{ 204, 0x0000, 0x3333, 0xffff, 0, 0 },
{ 205, 0x0000, 0x3333, 0xcccc, 0, 0 },
{ 206, 0x0000, 0x3333, 0x9999, 0, 0 },
{ 207, 0x0000, 0x3333, 0x6666, 0, 0 },
{ 208, 0x0000, 0x3333, 0x3333, 0, 0 },
{ 209, 0x0000, 0x3333, 0x0000, 0, 0 },
{ 210, 0x0000, 0x0000, 0xffff, 0, 0 },
{ 211, 0x0000, 0x0000, 0xcccc, 0, 0 },
{ 212, 0x0000, 0x0000, 0x9999, 0, 0 },
{ 213, 0x0000, 0x0000, 0x6666, 0, 0 },
{ 214, 0x0000, 0x0000, 0x3333, 0, 0 },
{ 215, 0xeeee, 0x0000, 0x0000, 0, 0 },
{ 216, 0xdddd, 0x0000, 0x0000, 0, 0 },
{ 217, 0xbbbb, 0x0000, 0x0000, 0, 0 },
{ 218, 0xaaaa, 0x0000, 0x0000, 0, 0 },
{ 219, 0x8888, 0x0000, 0x0000, 0, 0 },
{ 220, 0x7777, 0x0000, 0x0000, 0, 0 },
{ 221, 0x5555, 0x0000, 0x0000, 0, 0 },
{ 222, 0x4444, 0x0000, 0x0000, 0, 0 },
{ 223, 0x2222, 0x0000, 0x0000, 0, 0 },
{ 224, 0x1111, 0x0000, 0x0000, 0, 0 },
{ 225, 0x0000, 0xeeee, 0x0000, 0, 0 },
{ 226, 0x0000, 0xdddd, 0x0000, 0, 0 },
{ 227, 0x0000, 0xbbbb, 0x0000, 0, 0 },
{ 228, 0x0000, 0xaaaa, 0x0000, 0, 0 },
{ 229, 0x0000, 0x8888, 0x0000, 0, 0 },
{ 230, 0x0000, 0x7777, 0x0000, 0, 0 },
{ 231, 0x0000, 0x5555, 0x0000, 0, 0 },
{ 232, 0x0000, 0x4444, 0x0000, 0, 0 },
{ 233, 0x0000, 0x2222, 0x0000, 0, 0 },
{ 234, 0x0000, 0x1111, 0x0000, 0, 0 },
{ 235, 0x0000, 0x0000, 0xeeee, 0, 0 },
{ 236, 0x0000, 0x0000, 0xdddd, 0, 0 },
{ 237, 0x0000, 0x0000, 0xbbbb, 0, 0 },
{ 238, 0x0000, 0x0000, 0xaaaa, 0, 0 },
{ 239, 0x0000, 0x0000, 0x8888, 0, 0 },
{ 240, 0x0000, 0x0000, 0x7777, 0, 0 },
{ 241, 0x0000, 0x0000, 0x5555, 0, 0 },
{ 242, 0x0000, 0x0000, 0x4444, 0, 0 },
{ 243, 0x0000, 0x0000, 0x2222, 0, 0 },
{ 244, 0x0000, 0x0000, 0x1111, 0, 0 },
{ 245, 0xeeee, 0xeeee, 0xeeee, 0, 0 },
{ 246, 0xdddd, 0xdddd, 0xdddd, 0, 0 },
{ 247, 0xbbbb, 0xbbbb, 0xbbbb, 0, 0 },
{ 248, 0xaaaa, 0xaaaa, 0xaaaa, 0, 0 },
{ 249, 0x8888, 0x8888, 0x8888, 0, 0 },
{ 250, 0x7777, 0x7777, 0x7777, 0, 0 },
{ 251, 0x5555, 0x5555, 0x5555, 0, 0 },
{ 252, 0x4444, 0x4444, 0x4444, 0, 0 },
{ 253, 0x2222, 0x2222, 0x2222, 0, 0 },
{ 254, 0x1111, 0x1111, 0x1111, 0, 0 },
{ 255, 0xffff, 0xffff, 0xffff, 0, 0 }
};
#endif /* _DARWIN_CLUT8_ */
\ No newline at end of file diff --git a/xc/programs/Xserver/hw/darwin/darwinKeyboard.c b/xc/programs/Xserver/hw/darwin/darwinKeyboard.c index 1f466db01..6cdbba443 100644 --- a/xc/programs/Xserver/hw/darwin/darwinKeyboard.c +++ b/xc/programs/Xserver/hw/darwin/darwinKeyboard.c @@ -36,7 +36,7 @@ // //============================================================================= -/* $XFree86: xc/programs/Xserver/hw/darwin/darwinKeyboard.c,v 1.4 2001/04/01 07:12:13 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/darwinKeyboard.c,v 1.5 2001/04/25 02:23:47 torrey Exp $ */ /* =========================================================================== @@ -61,9 +61,13 @@ #include <drivers/event_status_driver.h> #include <IOKit/hidsystem/ev_keymap.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/stat.h> #include "darwin.h" #include "xfIOKit.h" #include "bundle/quartzAudio.h" +#include "bundle/quartzShared.h" #define XK_TECHNICAL // needed to get XK_Escape #include "keysym.h" @@ -197,7 +201,9 @@ static void DarwinChangeKeyboardControl( DeviceIntPtr device, KeybdCtrl *ctrl ) static CARD8 modMap[MAP_LENGTH]; static KeySym map[256 * GLYPHS_PER_KEY]; -static unsigned char modifierKeycodes[NX_NUMMODIFIERS][2]; +static unsigned char modifierKeycodes[NX_NUMMODIFIERS][2]; +static FILE *fref = NULL; +static char *inBuffer = NULL; //----------------------------------------------------------------------------- // Data Stream Object @@ -305,6 +311,102 @@ static void parse_next_char_code( } /* + * DarwinReadKeymapFile + * Read the appropriate keymapping from a keymapping file. + */ +Bool DarwinReadKeymapFile( + NXKeyMapping *keyMap ) +{ + struct stat st; + NXEventSystemDevice info[20]; + int interface = 0, handler_id = 0; + int map_interface, map_handler_id, map_size = 0; + unsigned int i, size; + Boolean hasMatch = FALSE; + union km_tag { + int *intP; + char *charP; + } km; + + fref = fopen( darwinKeymapFile, "rb" ); + if (fref == 0) { + ErrorF("Unable to open keymapping file %s.\n", darwinKeymapFile); + return FALSE; + } + assert( !fstat(fileno(fref), &st) ); + + // check to make sure we don't crash later + if (st.st_size <= 16*sizeof(int)) { + ErrorF("Invalid keymapping file.\n"); + return FALSE; + } + + inBuffer = (char*) xalloc( st.st_size ); + assert( fread(inBuffer, st.st_size, 1, fref) ); + + // find the keyboard interface and handler id + size = sizeof( info ) / sizeof( int ); + if (!NXEventSystemInfo( dfb.hidParam, NX_EVS_DEVICE_INFO, + (NXEventSystemInfoType) info, &size )) { + ErrorF("Error reading event status driver info.\n"); + return FALSE; + } + size = size * sizeof( int ) / sizeof( info[0] ); + for( i = 0; i < size; i++) { + if (info[i].dev_type == NX_EVS_DEVICE_TYPE_KEYBOARD) { + interface = info[i].interface; + handler_id = info[i].id; + break; + } + } + + // Find the appropriate keymapping: + // The first time through we try to match both interface and handler_id. + // If we can't match both, we take the first match for interface. + if (strncmp( inBuffer, "KYM1", 4 ) == 0) { + Bool hasInterface = FALSE; + int *bufferEnd = (int *) (inBuffer + st.st_size); + do { + km.charP = inBuffer; + km.intP++; + while (km.intP+3 < bufferEnd) { + map_interface = *(km.intP++); + map_handler_id = *(km.intP++); + map_size = *(km.intP++); + if (map_interface == interface) { + if (map_handler_id == handler_id || hasInterface) { + hasMatch = TRUE; + break; + } else { + hasInterface = TRUE; + } + } + km.charP += map_size; + } + if (hasMatch) break; + } while (hasInterface); + } else if (strncmp( inBuffer, "KYMP", 4 ) == 0) { + ErrorF("This old style keymapping file is intended for use with the original NeXT keyboards.\n"); + return FALSE; + } else { + ErrorF("The keymapping file has a bad magic number.\n"); + return FALSE; + } + + if (hasMatch) { + // fill in NXKeyMapping structure + keyMap->size = map_size; + keyMap->mapping = (char*) xalloc(map_size); + memcpy(keyMap->mapping, km.charP, map_size); + } else { + ErrorF("Keymapping file did not contain appropriate keyboard interface.\n"); + return FALSE; + } + + return TRUE; +} + +/* * DarwinKeyboardInit * Get the Darwin keyboard map and compute an equivalent * X keyboard map and modifier map. Set the new keyboard @@ -321,6 +423,7 @@ void DarwinKeyboardInit( DataStream *keyMapStream; unsigned char const *numPadStart = 0; BellProcPtr bellProc; + Bool haveKeymap = FALSE; memset( modMap, NoSymbol, sizeof( modMap ) ); memset( map, 0, sizeof( map ) ); @@ -333,10 +436,24 @@ void DarwinKeyboardInit( // for a kIOHIDParamConnectType connection. assert( dfb.hidParam = NXOpenEventStatus() ); - // get the Darwin keyboard map - keyMap.size = NXKeyMappingLength( dfb.hidParam ); - keyMap.mapping = (char*) xalloc( keyMap.size ); - assert( NXGetKeyMapping( dfb.hidParam, &keyMap )); + if (darwinKeymapFile) { + haveKeymap = DarwinReadKeymapFile(&keyMap); + if (fref) + fclose(fref); + if (inBuffer) + xfree(inBuffer); + if (!haveKeymap) { + ErrorF("Reverting to kernel keymapping.\n"); + } + } + + if (!haveKeymap) { + // get the Darwin keyboard map + keyMap.size = NXKeyMappingLength( dfb.hidParam ); + keyMap.mapping = (char*) xalloc( keyMap.size ); + assert( NXGetKeyMapping( dfb.hidParam, &keyMap )); + } + keyMapStream = new_data_stream( (unsigned char const*)keyMap.mapping, keyMap.size ); diff --git a/xc/programs/Xserver/hw/darwin/xfIOKit.c b/xc/programs/Xserver/hw/darwin/xfIOKit.c index 5f6f93c90..121c40ba3 100644 --- a/xc/programs/Xserver/hw/darwin/xfIOKit.c +++ b/xc/programs/Xserver/hw/darwin/xfIOKit.c @@ -8,7 +8,7 @@ * Significantly rewritten for XFree86 4.0.1 by Torrey Lyons * **************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/darwin/xfIOKit.c,v 1.5 2001/04/02 05:39:36 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/xfIOKit.c,v 1.7 2001/04/16 06:51:48 torrey Exp $ */ #define NDEBUG 1 @@ -104,7 +104,7 @@ void XFIOKitBell( */ void XFIOKitGiveUp( void ) { -#if 0 +#if 1 // we must close the HID System first // because it is a client of the framebuffer NXCloseEventStatus( dfb.hidParam ); @@ -326,6 +326,13 @@ static void SetupFBandHID(void) kIOFBSystemAperture, &dfb.pixelInfo ); kern_assert( kr ); +#ifdef __i386__ + /* x86 in 8bit mode currently needs fixed color map... */ + if( dfb.pixelInfo.bitsPerComponent == 8 ) { + dfb.pixelInfo.pixelType = kIOFixedCLUTPixels; + } +#endif + #ifdef OLD_POWERBOOK_G3 if (dfb.pixelInfo.pixelType == kIOCLUTPixels) dfb.pixelInfo.pixelType = kIOFixedCLUTPixels; @@ -438,6 +445,8 @@ void XFIOKitOsVendorInit(void) kern_return_t kr; int fd[2]; + ErrorF("Display mode: IOKit\n"); + kr = IOMasterPort(bootstrap_port, &masterPort); kern_assert( kr ); diff --git a/xc/programs/Xserver/hw/darwin/xfIOKitStartup.c b/xc/programs/Xserver/hw/darwin/xfIOKitStartup.c index 284d97c87..dafaa86b6 100644 --- a/xc/programs/Xserver/hw/darwin/xfIOKitStartup.c +++ b/xc/programs/Xserver/hw/darwin/xfIOKitStartup.c @@ -3,7 +3,7 @@ * Startup code for the IOKit Darwin X Server * **************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/darwin/xfIOKitStartup.c,v 1.2 2001/04/01 07:12:13 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/xfIOKitStartup.c,v 1.3 2001/04/11 08:34:18 torrey Exp $ */ #include "mi.h" #include "mipointer.h" @@ -39,7 +39,7 @@ void QuartzHide(void) { FatalError("QuartzHide called without Quartz support.\n"); } -void QuartzShow(void) { +void QuartzShow(int x, int y) { FatalError("QuartzShow called without Quartz support.\n"); } diff --git a/xc/programs/Xserver/hw/sun/Imakefile b/xc/programs/Xserver/hw/sun/Imakefile index bc1e3f6d2..91848b267 100644 --- a/xc/programs/Xserver/hw/sun/Imakefile +++ b/xc/programs/Xserver/hw/sun/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:48:29 cpqbld Exp $ -XCOMM $XFree86: xc/programs/Xserver/hw/sun/Imakefile,v 1.5 2001/01/17 22:36:49 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/sun/Imakefile,v 1.6 2001/04/16 20:57:04 herrb Exp $ #include <Server.tmpl> @@ -66,7 +66,7 @@ NormalLintTarget($(SRCS1)) #ifndef i386Architecture sunInExMono.o: $(ICONFIGFILES) -ObjectFromSpecialSource(sunInExMono,../../mi/miinitext,-I$(EXTINCSRC) $(EXT_DEFINES) -UPEXEXT -UGLXEXT) +ObjectFromSpecialSource(sunInExMono,../../mi/miinitext,-I$(EXTINCSRC) $(EXT_DEFINES) -UPEXEXT -UGLXEXT -UXV -UXF86BIGFONT -UXF86MISC -URENDER) ObjectFromSpecialSource(sunInitMono,sunInit,-DSUNMAXDEPTH=1) ObjectFromSpecialSource(sunInitMulti,sunInit,-DSUNMAXDEPTH=32) #endif diff --git a/xc/programs/Xserver/hw/vfb/Imakefile b/xc/programs/Xserver/hw/vfb/Imakefile index 07303d096..6e689896e 100644 --- a/xc/programs/Xserver/hw/vfb/Imakefile +++ b/xc/programs/Xserver/hw/vfb/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.5 2000/08/17 19:48:38 cpqbld Exp $ -XCOMM $XFree86: xc/programs/Xserver/hw/vfb/Imakefile,v 3.27 2001/03/04 17:40:10 herrb Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/vfb/Imakefile,v 3.28 2001/04/25 19:44:01 tsi Exp $ #include <Server.tmpl> @@ -12,7 +12,13 @@ SHMDEF = -DHAS_SHM #endif XCOMM add more architectures here as we discover them -#if defined(HPArchitecture) || (defined(SparcArchitecture) && !defined(LynxOSArchitecture)) || SystemV4 || defined(OSF1Architecture) || defined(i386BsdArchitecture) || defined(LinuxArchitecture) || defined(DarwinArchitecture) +#if defined(HPArchitecture) || \ + (defined(SparcArchitecture) && !defined(LynxOSArchitecture)) || \ + SystemV4 || \ + defined(OSF1Architecture) || \ + defined(i386BsdArchitecture) || \ + defined(LinuxArchitecture) || \ + defined(DarwinArchitecture) MMAPDEF = -DHAS_MMAP #endif @@ -34,7 +40,7 @@ INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \ -I../../fb -I../../mfb -I../../mi -I../../include -I../../os \ -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(SERVERSRC)/render -DEFINES = ServerOSDefines $(SHMDEF) $(MMAPDEF) -UXFree86LOADER -UXF86DRI +DEFINES = $(OS_DEFINES) $(SHMDEF) $(MMAPDEF) -UXFree86LOADER -UXF86DRI #if BuildDPMS diff --git a/xc/programs/Xserver/hw/vfb/ntux_xf.c b/xc/programs/Xserver/hw/vfb/ntux_xf.c index 1f813a01f..de0ba128b 100644 --- a/xc/programs/Xserver/hw/vfb/ntux_xf.c +++ b/xc/programs/Xserver/hw/vfb/ntux_xf.c @@ -17,7 +17,7 @@ software will be error-free. THESE DISCLAIMERS OF WARRANTY CONSTITUTE AN ESSENTIAL PART OF THIS AGREEMENT. */ -/* $XFree86: xc/programs/Xserver/hw/vfb/ntux_xf.c,v 3.1 2000/08/10 17:40:31 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/vfb/ntux_xf.c,v 3.2 2001/04/18 17:14:01 dawes Exp $ */ /* * ntux_xf.c @@ -37,7 +37,7 @@ AGREEMENT. -#include <windows.h> +#include "windows.h" #include <stdio.h> #include "keysym.h" diff --git a/xc/programs/Xserver/hw/vfb/windef.h b/xc/programs/Xserver/hw/vfb/windef.h new file mode 100644 index 000000000..eb1b39cf3 --- /dev/null +++ b/xc/programs/Xserver/hw/vfb/windef.h @@ -0,0 +1,227 @@ +/* $XFree86: xc/programs/Xserver/hw/vfb/windef.h,v 1.2 2001/04/27 12:58:28 dawes Exp $ */ + +#ifndef _WINDEF_H +#define _WINDEF_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef WINVER +#define WINVER 0x0400 +#endif +#ifndef _WIN32_WINNT +#define _WIN32_WINNT WINVER +#endif +#ifndef WIN32 +#define WIN32 +#endif +#ifndef _WIN32 +#define _WIN32 +#endif +#define FAR +#define far +#define NEAR +#define near +#ifndef CONST +#define CONST const +#endif +#undef MAX_PATH +#define MAX_PATH 260 + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void*)0) +#endif +#endif +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef TRUE +#define TRUE 1 +#endif +#define IN +#define OUT +#ifndef OPTIONAL +#define OPTIONAL +#endif + +#ifdef __GNUC__ +#define PACKED __attribute__((packed)) +#ifndef _stdcall +#define _stdcall __attribute__((stdcall)) +#endif +#ifndef __stdcall +#define __stdcall __attribute__((stdcall)) +#endif +#ifndef _cdecl +#define _cdecl __attribute__((cdecl)) +#endif +#ifndef __cdecl +#define __cdecl __attribute__((cdecl)) +#endif +#ifndef __declspec +#define __declspec(e) __attribute__((e)) +#endif +#ifndef _declspec +#define _declspec(e) __attribute__((e)) +#endif +#else +#define PACKED +#define _cdecl +#define __cdecl +#endif + +#undef pascal +#undef _pascal +#undef __pascal +#define pascal __stdcall +#define _pascal __stdcall +#define __pascal __stdcall +#define PASCAL _pascal +#define CDECL _cdecl +#define STDCALL __stdcall +#define WINAPI __stdcall +#define WINAPIV __cdecl +#define APIENTRY __stdcall +#define CALLBACK __stdcall +#define APIPRIVATE __stdcall + +#define DECLSPEC_IMPORT __declspec(dllimport) +#define DECLSPEC_EXPORT __declspec(dllexport) +#define DECLSPEC_NORETURN __declspec(noreturn) +#define MAKEWORD(a,b) ((WORD)(((BYTE)(a))|(((WORD)((BYTE)(b)))<<8))) +#define MAKELONG(a,b) ((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16))) +#define LOWORD(l) ((WORD)((DWORD)(l))) +#define HIWORD(l) ((WORD)(((DWORD)(l)>>16)&0xFFFF)) +#define LOBYTE(w) ((BYTE)(w)) +#define HIBYTE(w) ((BYTE)(((WORD)(w)>>8)&0xFF)) + +#ifndef _export +#define _export +#endif +#ifndef __export +#define __export +#endif + +#ifndef NOMINMAX +#ifndef max +#define max(a,b) ((a)>(b)?(a):(b)) +#endif +#ifndef min +#define min(a,b) ((a)<(b)?(a):(b)) +#endif +#endif + +#define UNREFERENCED_PARAMETER(P) {(P)=(P);} +#define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);} +#define DBG_UNREFERENCED_PARAMETER(P) +#define DBG_UNREFERENCED_LOCAL_VARIABLE(L) + +typedef unsigned long DWORD; +typedef int WINBOOL,*PWINBOOL,*LPWINBOOL; +/* FIXME: Is there a good solution to this? */ +#ifndef __OBJC__ +typedef WINBOOL BOOL; +#else +#define BOOL WINBOOL +#endif +typedef unsigned char BYTE; +typedef BOOL *PBOOL, *LPBOOL; +typedef unsigned short WORD; +typedef float FLOAT; +typedef FLOAT *PFLOAT; +typedef BYTE *PBYTE,*LPBYTE; +typedef int *PINT,*LPINT; +typedef WORD *PWORD,*LPWORD; +typedef long *LPLONG; +typedef DWORD *PDWORD,*LPDWORD; +typedef void *PVOID,*LPVOID; +typedef CONST void *PCVOID,*LPCVOID; +typedef int INT; +typedef unsigned int UINT,*PUINT,*LPUINT; + +#include <winnt.h> + +typedef UINT WPARAM; +typedef LONG LPARAM; +typedef LONG LRESULT; +#ifndef _HRESULT_DEFINED +typedef LONG HRESULT; +#define _HRESULT_DEFINED +#endif +typedef WORD ATOM; +typedef HANDLE HGLOBAL; +typedef HANDLE HLOCAL; +typedef HANDLE GLOBALHANDLE; +typedef HANDLE LOCALHANDLE; +typedef void *HGDIOBJ; +DECLARE_HANDLE(HACCEL); +DECLARE_HANDLE(HBITMAP); +DECLARE_HANDLE(HBRUSH); +DECLARE_HANDLE(HCOLORSPACE); +DECLARE_HANDLE(HDC); +DECLARE_HANDLE(HGLRC); +DECLARE_HANDLE(HDESK); +DECLARE_HANDLE(HENHMETAFILE); +DECLARE_HANDLE(HFONT); +DECLARE_HANDLE(HICON); +DECLARE_HANDLE(HKEY); +/* FIXME: How to handle these. SM_CMONITORS etc in winuser.h also. */ +/* #if (WINVER >= 0x0500) */ +DECLARE_HANDLE(HMONITOR); +DECLARE_HANDLE(HTERMINAL); +DECLARE_HANDLE(HWINEVENTHOOK); +/* #endif */ +typedef HKEY *PHKEY; +DECLARE_HANDLE(HMENU); +DECLARE_HANDLE(HMETAFILE); +DECLARE_HANDLE(HINSTANCE); +typedef HINSTANCE HMODULE; +DECLARE_HANDLE(HPALETTE); +DECLARE_HANDLE(HPEN); +DECLARE_HANDLE(HRGN); +DECLARE_HANDLE(HRSRC); +DECLARE_HANDLE(HSTR); +DECLARE_HANDLE(HTASK); +DECLARE_HANDLE(HWND); +DECLARE_HANDLE(HWINSTA); +DECLARE_HANDLE(HKL); +typedef int HFILE; +typedef HICON HCURSOR; +typedef DWORD COLORREF; +typedef int (WINAPI *FARPROC)(); +typedef int (WINAPI *NEARPROC)(); +typedef int (WINAPI *PROC)(); +typedef struct tagRECT { + LONG left; + LONG top; + LONG right; + LONG bottom; +} RECT,*PRECT,*LPRECT; +typedef const RECT *LPCRECT; +typedef struct tagRECTL { + LONG left; + LONG top; + LONG right; + LONG bottom; +} RECTL,*PRECTL,*LPRECTL; +typedef const RECTL *LPCRECTL; +typedef struct tagPOINT { + LONG x; + LONG y; +} POINT,POINTL,*PPOINT,*LPPOINT,*PPOINTL,*LPPOINTL; +typedef struct tagSIZE { + LONG cx; + LONG cy; +} SIZE,SIZEL,*PSIZE,*LPSIZE,*PSIZEL,*LPSIZEL; +typedef struct tagPOINTS { + SHORT x; + SHORT y; +} POINTS,*PPOINTS,*LPPOINTS; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/xc/programs/Xserver/hw/vfb/windows.h b/xc/programs/Xserver/hw/vfb/windows.h new file mode 100644 index 000000000..33c4db61a --- /dev/null +++ b/xc/programs/Xserver/hw/vfb/windows.h @@ -0,0 +1,152 @@ +/* $XFree86: xc/programs/Xserver/hw/vfb/windows.h,v 1.2 2001/04/27 12:58:28 dawes Exp $ */ +/* + windows.h - main header file for the Win32 API + + Written by Anders Norlander <anorland@hem2.passagen.se> + + This file is part of a free library for the Win32 API. + + This library 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. + +*/ +#ifndef _WINDOWS_H +#define _WINDOWS_H +/* translate GCC target defines to MS equivalents. Keep this synchronized + with winnt.h. */ +#if defined(__i686__) && !defined(_M_IX86) +#define _M_IX86 600 +#elif defined(__i586__) && !defined(_M_IX86) +#define _M_IX86 500 +#elif defined(__i486__) && !defined(_M_IX86) +#define _M_IX86 400 +#elif defined(__i386__) && !defined(_M_IX86) +#define _M_IX86 300 +#endif +#if defined(_M_IX86) && !defined(_X86_) +#define _X86_ +#elif defined(_M_ALPHA) && !defined(_ALPHA_) +#define _ALPHA_ +#elif defined(_M_PPC) && !defined(_PPC_) +#define _PPC_ +#elif defined(_M_MRX000) && !defined(_MIPS_) +#define _MIPS_ +#elif defined(_M_M68K) && !defined(_68K_) +#define _68K_ +#endif + +#ifdef RC_INVOKED +/* winresrc.h includes the necessary headers */ +#include <winresrc.h> +#else + +#ifdef __GNUC__ +#ifndef NONAMELESSUNION +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define _ANONYMOUS_UNION +#define _ANONYMOUS_STRUCT +#else +#if defined(__cplusplus) +#define _ANONYMOUS_UNION +#endif +#endif /* __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) */ +#endif /* NONAMELESSUNION */ +#endif /* __GNUC__ */ + +#ifndef _ANONYMOUS_UNION +#define _UNION_NAME(x) x +#define DUMMYUNIONNAME u +#define DUMMYUNIONNAME2 u2 +#define DUMMYUNIONNAME3 u3 +#define DUMMYUNIONNAME4 u4 +#define DUMMYUNIONNAME5 u5 +#define DUMMYUNIONNAME6 u6 +#define DUMMYUNIONNAME7 u7 +#define DUMMYUNIONNAME8 u8 +#else +#define _UNION_NAME(x) +#define DUMMYUNIONNAME +#define DUMMYUNIONNAME2 +#define DUMMYUNIONNAME3 +#define DUMMYUNIONNAME4 +#define DUMMYUNIONNAME5 +#define DUMMYUNIONNAME6 +#define DUMMYUNIONNAME7 +#define DUMMYUNIONNAME8 +#endif +#ifndef _ANONYMOUS_STRUCT +#define _STRUCT_NAME(x) x +#define DUMMYSTRUCTNAME s +#define DUMMYSTRUCTNAME2 s2 +#define DUMMYSTRUCTNAME3 s3 +#else +#define _STRUCT_NAME(x) +#define DUMMYSTRUCTNAME +#define DUMMYSTRUCTNAME2 +#define DUMMYSTRUCTNAME3 +#endif + +#ifndef NO_STRICT +#ifndef STRICT +#define STRICT 1 +#endif +#endif + +#include <stdarg.h> +#include "windef.h" +#include <wincon.h> +#include <basetyps.h> +#include <excpt.h> +#include <winbase.h> +#ifndef _WINGDI_H +#include <wingdi.h> +#endif +#ifndef _WINUSER_H +#include <winuser.h> +#endif +#ifndef _WINNLS_H +#include <winnls.h> +#endif +#ifndef _WINVER_H +#include <winver.h> +#endif +#ifndef _WINNETWK_H +#include <winnetwk.h> +#endif +#ifndef _WINREG_H +#include <winreg.h> +#endif +#ifndef _WINSVC_H +#include <winsvc.h> +#endif + +#ifndef WIN32_LEAN_AND_MEAN +#include <commdlg.h> +#include <cderr.h> +#include <dde.h> +#include <ddeml.h> +#include <dlgs.h> +#include <lzexpand.h> +#include <mmsystem.h> +#include <nb30.h> +#include <rpc.h> +#include <shellapi.h> +#include <winperf.h> +#include <winspool.h> +#if defined(Win32_Winsock) || !(defined(__INSIDE_CYGWIN__) || defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(_UWIN)) +#include <winsock.h> +#endif +#endif /* WIN32_LEAN_AND_MEAN */ + +#endif /* RC_INVOKED */ + +#ifdef __OBJC__ +/* FIXME: Not undefining BOOL here causes all BOOLs to be WINBOOL (int), + but undefining it causes trouble as well if a file is included after + windows.h +*/ +#undef BOOL +#endif + +#endif diff --git a/xc/programs/Xserver/hw/xfree86/CHANGELOG b/xc/programs/Xserver/hw/xfree86/CHANGELOG index 0befffcb7..fd4d0babe 100644 --- a/xc/programs/Xserver/hw/xfree86/CHANGELOG +++ b/xc/programs/Xserver/hw/xfree86/CHANGELOG @@ -1,3 +1,210 @@ +XFree86 4.0.99.3 (26 April 2001) + 452. Fix dependencies for libGLU on Cygwin/XFree86 (Alan Hourihane). + 451. Make xdm & xfs compile on Cygwin/XFree86 (Alan Hourihane). + 450. Update Japanese localization of XDarwin.app's Preferences window + (Toshimitsu Tanaka). + 449. Don't build clients that require extension libraries unless those + libraries are being built (#A.386, Scott A McConnell, David Dawes). + 448. Fix the BuildXinerama test in Xserver/Imakefile (#4615, Harold Hunt). + 447. Ignore MakeDllModules when DoLoadableServer isn't set (#4613, + Guido Guenther). + 446. Don't define the <Ctrl>T compose sequences in the iso8859-1 compose + map by default (#4611, Mike Harris). + 445. Allow the nls compose data files to be pre-processed (David Dawes). + 444. Fix some problems introduced with the internationalisation of twm + (#4607, Juliusz Chroboczek). + 443. Fix dpsinfo so that the correct headers are included (#4606, + Juliusz Chroboczek). + 442. Fix mismatches between the way xlsfonts interprets font properties and + the way they are defined in the XLFD spec (#4604, Jochen Voss). + 441. Add entries for German iso-8859-15 locales (#4603, + Philipp Matthias Hahn). + 440. Cleanup build in Xserver/GL/mesa, making use of the earlier cleanups in + the lib/GL build (David Dawes). #4602 is redundant as a result. + 439. [SECURITY] Check for negative reply length/overflow in _XAsyncReply + (Xlib) (#4601, Mike Harris). + 438. New 'hu' xkb symbols file (#A.364, Peter Soos). + 437. Trident driver fixes for PC98 platforms (#4612, Akio Morita). + 436. Convert apm driver from cfb to fb (Alan Hourihane). + 435. Fix makedepend for '//' comment parsing and symbols that contain + expressions (Marc La France). + 434. Fix a problem with the mga G400 2nd head going into power saver mode + when it should be blanked, and enable DPMS for the 2nd head (#A.358, + Craig Leres). + 433. Fix a horizontal resolution problem that shows up with mga Xv (#A.365, + Ewald Snel). + 432. Work around a refresh rate problem when using custom modelines that + have a refresh rate > 100Hz with the Matrox HAL library (#A.360, + Ewald Snel). + 431. XDarwin fixes: + - Provide work around for kernel/driver issue on Darwin 1.3 that + causes the kernel keymapping to be empty on Mac portables. + - Command line -dpi option is no longer ignored. + (Torrey Lyons). + 430. Ensure that the X-TT module isn't built if the Xserver isn't being + built (#4594, Chu-yeon Park). + 429. Make xconsole try to reopen the /dev/xconsole pipe when it gets an EOF + (#4593, Jeff King). + 428. Prevent an infinite loop (or unpredictable behaviour) in xmodmap (#4592, + Peter Maydell). + 427. Add a font substitute for the zh locale (#4590, submitted by Branden + Robinson). + 426. Make the backspace key definitions for the xkb macintosh/us and + dvorak layouts consistent with the default 'us' layout (#4588, 4589, + Branden Robinson). + 425. Update for the sessreg man page (#4587, Branden Robinson). + 424. Add a font substitute for the ko locale (#4586, Changwoo Ryu). + 423. Avoid using fileno() in xauth's signal handler, and write messages to + stderr rather than stdout (#4585, submitted by Branden Robinson). + 422. Fix nested comment warnings in dix/gc.c (#4584, Branden Robinson). + 421. Include <stdlib.h> in two lbxutil files to get malloc/free prototypes + (#4583, submitted by Branden Robinson). + 420. Remove duplicate paragraph in xdm man page (#4582, Branden Robinson). + 419. Fix line numbers in error messages when parsing .twmrc files (#4580, + Topi Miettinen). + 418. Fix backwards font glyphs in the ati/Mach64 driver for big endian + platforms (#4579, Michael Dänzer). + 417. Add a build-time option to xf86config to make it append the major version + number to the config file name (David Dawes, prompted by #4577, + Branden Robinson). + 416. xf86config build fix for non-GNU make (Marc La France). + 415. Build fix for Summa driver on SunOS/Sparc (Marc La France). + 414. compiler.h cleanup (Marc La France). + 413. More DependDefines, OS_DEFINES and EXT_DEFINES build fixes + (Marc La France). + 412. Fix installation of specs docs (#4575, Branden Robinson). + 411. Make Cygwin/XFree86 call miSetPixmapDepth for RENDER extension + (Alan Hourihane). + 410. Xterm patch #155 (Thomas Dickey): correct change to return-type of + in_put(), which caused problem with UTF-8 (fixed by Bruno Haible). + 409. Some unobstrusive preparations for SunOS/Sparc (Marc La France). + 408. Remove unnecessary libxf86_os link into Xnest & Xvfb (Marc La France). + 407. Disable building of SuperProbe by default (Alan Hourihane). + 406. Make OS_DEFINES available to all server Makefiles (Marc La France). + 405. Add support to xman for parsing '\" <string> formatting hints. + Also cleanup some of the vendor-specific definitions and fix + processing of mandoc pages on FreeBSD (based on #4573, + Branden Robinson, David Dawes). + 404. Fix default mailbox selection in xbiff for Linux, add recognition of + $MAIL, and update the man page accordingly (based on #4571, + Branden Robinson). + 403. Remove redundant PCI id definitions in the tdfx driver, and clean up + the messages printed when the DRI can't be enabled because the bpp + isn't supported (based on #4570, Branden Robinson and #4598, + Antti Tapaninen). Also, re-enable soft booting. + 402. Install the XftConfig file under $(CONFDIR), with a link from the + usual place (based on #4569, Branden Robinson). + 401. Update the Debian section on linux.cf (#4568, Branden Robinson). + 400. Startx fixes/enhancements, including: + - Fix argument processing. + - Set XAUTHORITY. + - Don't overwrite existing cookies, and remove ones added for this + session when exiting. + - Deallocate the VT that X was using. + - Update the man page. + (based on #4567, Branden Robinson, Henry T. So, Jr). + 399. Implement two new driver-provided options in the common cursor code and + use them to work around hardware bug that causes flickering Mach64 + hardware cursors (Marc La France). + 398. Integrate SiS driver changes (Ademar De Souza Reis). + 397. Initialize Elsa GloriaXXL (GLINT) framebuffer properly (Alan Hourihane). + 396. Fix bug where XDarwin.app would not hide the X display when it was no + longer the active application (Torrey Lyons). + 395. Make XDarwin.app ignore .xserverrc file when started from the GUI so + that it starts correctly (Torrey Lyons). + 394. Cygwin updates (#4557, 4558, 4563, Suhaib Siddiqi). + 393. Document the usage of the -server option in the xfsinfo man page (#4562, + Mike Harris). + 392. Fix xfs man page problem (#4561, Mike Harris). + 391. Fix a crash that happens when a font encoding has no aliases and it is + invoked using a non-canonical name (#4560, Takeshi Miyasaka). + 390. Add imake/config support for distinguising big endian and little endian + MipsArchitecture types (#4556, Florian Lohoff). + 389. Add support to the mga driver for auto-detecting the display type + (#4555, Stephane Duguay (Matrox)). + 388. Savage driver updates, including: + - Enable the Render extension. + - Make the DGA mode setup look more like the other drivers. + - First cut at Xvideo for the Savage4. + - Add a "ShadowStatus" option, which is a reliable workaround for the + scrolling hang that many experience. + (#4554, Tim Roberts). + 387. Enable wide character support for NetBSD 1.5P and later (#4553, + Matthias Scheler). + 386. Add offscreen image support to the i810 driver (for Xv), and fix + physMemBase (#4552, Matthew Sottek). + 385. Fix bad cut&paste update to the sunffb driver (#4551, David S. Miller). + 384. Fix "DriDrivers" typo in the sparc section of xfree86.cf (#4550, + David S. Miller). + 383. Update UCS 75dpi and 100dpi fonts, including adding UCS versions of + the UTBI and UTB fonts that were in the unnec_75dpi and unnec_100dpi + directories. The other "unnec" fonts are also moved over (#4548, + Markus Kuhn). + 382. Make the v4l driver module keep searching for more devices if the first + one can't do overlay (#4545, 4614, Gerd Knorr). + 381. Bug fixes for Xv support using a Permedia3 chip (#4564, Sven Luther). + 380. Xterm patches #151, #152, #153, #154 (Thomas Dickey): + - improve select/paste of COMPOUND_TEXT and UTF8_STRING (Juliusz + Chroboczek, Bruno Haible). + - fixes for erase operations (Alexander V Lukyanov). + - correct ifdef for bold overstriking when built to support UTF-8. + - change resource corresponding to "-T" option to match Xt library's + "-title", i.e., ".title" rather than "*title" so the command-line + options are interchangeable as documented (Debian bug report #68843). + - modify "RequestResize()" function to save/restore window manager hints + (Debian bug report #79939). + - improved error checking for input-method initialization. + - minor fixes for terminfo entries. + - various build/portability fixes. + 379. XDarwin fixes: + - Don't SetUID XDarwin X server. (The IOKit doesn't need it.) + - Startup message reports correct display mode. + - XDarwin.app is now installed in /Applications by default. + - Update xinit server name list. + - "make clean" now works for a non-root user. + (Torrey T. Lyons) + 378. Make XDarwin correctly handle color hardware cursors in Quartz mode + (Gregory Parker). + 377. Fixes to the XDarwin application: + - Display menubar when started without a splash screen. + - Query before quitting from Aqua when started with startx. + (Torrey T. Lyons). + 376. Update Japanese localization for XDarwin application (Toshimitsu Tanaka). + 375. Fix byte ordering and static colormap issues with XDarwin server + on x86 hardware (Rob Braun). + 374. Fix problems with XDarwin hardware cursor support in Quartz mode + (Gregory Parker). + 373. Resync with DRI CVS trunk (VA Linux Systems). + 372. Fix bug in XvMC protocol (Bob Paauwe). + 371. Ensure NoInt10 is used for PC98 (Alan Hourihane). + 370. Fix PC98 issues with the trident driver (#4547, Akio Morita). + 369. Add a NoInt10 option to the int10 module, allowing it to be disabled + per entity (Alan Hourihane). + 368. Fixes to the XDarwin application: + - X clients are now started correctly. + - Shuts down cleanly. + - Removed erroneous NSString releases in quartzCocoa.m. + - Dragging with mouse button 3 or higher depressed produces events. + (Christoph Pfisterer and Torrey Lyons) + 367. Make the ramdac module for the IBM RGB640 DAC work at depth 15 + (Alan Hourihane). + 366. Fix interference between acceleration and hardware cursors on Mach64 + variants (Marc La France). + 365. Fix xload so it is functional on Darwin OS (Rob Braun). + 364. Mac OS X specific fixes: + - Fix typo in XDarwin startup program that could cause crash with + many command line options. + - Move Show/HideMenuBar() call to main thread so that XDarwin + application displays a menu bar on the Mac OS X desktop. + (Greg Parker). + 363. XDarwin application fixes including: + - Fix bugs causing XDarwin preferences to not be saved correctly. + - When using system beep, turn off bell when beep volume is set to 0. + (Christoph Pfisterer). + 362. Fix building of dpsops.h and psops.h in correct order (Alan Hourihane). + 361. Change xvmc.h to xvmcext.h to avoid case-(in)sensitive name clash with + XvMC.h for Cygwin/XFree86 (Alan Hourihane). + XFree86 4.0.99.2 (6 April 2001) 360. Fbdev driver updates, including: - Switch from shadowfb to mishadow. @@ -189,7 +396,7 @@ XFree86 4.0.99.2 (6 April 2001) Quit Xdarwin cleanly, wether from the Xserve or from Cocoa front end, Fix a case typp which cases the Xdarwin server not to start if installed on a case sensitive file system like UFS. - (#4504, #4507, #45011, Gegory Parker, Torrey T. Lyons). + (#4504, #4507, #45011, Gregory Parker, Torrey T. Lyons). 271. Move Section DRI/Endsection into the DRI function to be consistant with all of the other sections. (Quentin Neill) 270. Made xf4bpp code moer 64bit clean (still doesn't work on Alphas) @@ -12897,4 +13104,4 @@ XFree86 3.0a (28 April 1994) XFree86 3.0 (26 April 1994) -$XFree86: xc/programs/Xserver/hw/xfree86/CHANGELOG,v 3.1671 2001/04/06 18:16:27 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/CHANGELOG,v 3.1724 2001/04/27 11:47:10 alanh Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/Imakefile b/xc/programs/Xserver/hw/xfree86/Imakefile index cd00fd573..dbf721499 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.74 2001/04/03 22:51:00 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/Imakefile,v 3.75 2001/04/20 16:00:47 alanh Exp $ #include <Server.tmpl> #define IHaveSubdirs @@ -67,9 +67,7 @@ RACDIR = rac INT10DIR = int10 #endif -#if !defined(OsfArchitecture) && !defined(AmoebaArchitecture) && \ - !defined(ArcArchitecture) && !defined(Arm32Architecture) && \ - !defined(PpcArchitecture) && !defined(MipsArchitecture) +#if BuildSuperProbe SUPERPROBE = SuperProbe #endif diff --git a/xc/programs/Xserver/hw/xfree86/common/Imakefile b/xc/programs/Xserver/hw/xfree86/common/Imakefile index d72ac7aba..13fd279ee 100644 --- a/xc/programs/Xserver/hw/xfree86/common/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/common/Imakefile @@ -4,7 +4,7 @@ XCOMM $XConsortium: Imakefile /main/34 1996/10/27 11:05:08 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.130 2001/03/24 16:32:41 herrb Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.133 2001/04/21 20:08:06 herrb Exp $ @@ -187,7 +187,7 @@ XCONFIGDEFINES = -DPROJECTROOT='"$(PROJECTROOT)"' \ XF86CONFIGFILE = XConfigFile XCONFIGUREDEFINES = -DXF86CONFIGFILE='"$(XF86CONFIGFILE)"' - DEFINES = $(CONSDEFINES) $(KBDDEFINES) $(EXT_DEFINES) $(OSDEFINES) + DEFINES = $(CONSDEFINES) $(KBDDEFINES) $(EXT_DEFINES) $(OS_DEFINES) AllTarget($(OFILES)) diff --git a/xc/programs/Xserver/hw/xfree86/common/compiler.h b/xc/programs/Xserver/hw/xfree86/common/compiler.h index 0e93aac95..f35d33cf5 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.79 2001/04/01 14:00:07 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.81 2001/04/23 16:17:11 tsi Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -450,7 +450,7 @@ __ustw (unsigned long r5, unsigned short * r11) #define outw(a,b) _outw(b,a) #define outl(a,b) _outl(b,a) -#elif (defined(linux) || defined(Lynx)) && defined(__sparc__) +#elif (defined(linux) || defined(Lynx) || defined(sun)) && defined(__sparc__) #if !defined(Lynx) #ifndef ASI_PL @@ -459,92 +459,126 @@ __ustw (unsigned long r5, unsigned short * r11) #define barrier() __asm__ __volatile__(".word 0x8143e00a": : :"memory") -static __inline__ void outb(unsigned long port, unsigned char val) +static __inline__ void +outb(unsigned long port, unsigned char val) { - __asm__ __volatile__("stba %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL)); + __asm__ __volatile__("stba %0, [%1] %2" + : /* No outputs */ + : "r" (val), "r" (port), "i" (ASI_PL)); barrier(); } -static __inline__ void outw(unsigned long port, unsigned short val) +static __inline__ void +outw(unsigned long port, unsigned short val) { - __asm__ __volatile__("stha %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL)); + __asm__ __volatile__("stha %0, [%1] %2" + : /* No outputs */ + : "r" (val), "r" (port), "i" (ASI_PL)); barrier(); } -static __inline__ void outl(unsigned long port, unsigned int val) +static __inline__ void +outl(unsigned long port, unsigned int val) { - __asm__ __volatile__("sta %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL)); + __asm__ __volatile__("sta %0, [%1] %2" + : /* No outputs */ + : "r" (val), "r" (port), "i" (ASI_PL)); barrier(); } -static __inline__ unsigned int inb(unsigned long port) +static __inline__ unsigned int +inb(unsigned long port) { unsigned int ret; - __asm__ __volatile__("lduba [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL)); + __asm__ __volatile__("lduba [%1] %2, %0" + : "=r" (ret) + : "r" (port), "i" (ASI_PL)); return ret; } -static __inline__ unsigned int inw(unsigned long port) +static __inline__ unsigned int +inw(unsigned long port) { unsigned int ret; - __asm__ __volatile__("lduha [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL)); + __asm__ __volatile__("lduha [%1] %2, %0" + : "=r" (ret) + : "r" (port), "i" (ASI_PL)); return ret; } -static __inline__ unsigned int inl(unsigned long port) +static __inline__ unsigned int +inl(unsigned long port) { unsigned int ret; - __asm__ __volatile__("lda [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL)); + __asm__ __volatile__("lda [%1] %2, %0" + : "=r" (ret) + : "r" (port), "i" (ASI_PL)); return ret; } -static __inline__ unsigned char xf86ReadMmio8(void *base, const unsigned long offset) +static __inline__ unsigned char +xf86ReadMmio8(__volatile__ void *base, const unsigned long offset) { unsigned long addr = ((unsigned long)base) + offset; unsigned char ret; - __asm__ __volatile__("lduba [%1] %2, %0" : "=r" (ret) : "r" (addr), "i" (ASI_PL)); + __asm__ __volatile__("lduba [%1] %2, %0" + : "=r" (ret) + : "r" (addr), "i" (ASI_PL)); return ret; } -static __inline__ unsigned short xf86ReadMmio16Be(void *base, const unsigned long offset) +static __inline__ unsigned short +xf86ReadMmio16Be(__volatile__ void *base, const unsigned long offset) { unsigned long addr = ((unsigned long)base) + offset; unsigned short ret; - __asm__ __volatile__("lduh [%1], %0" : "=r" (ret) : "r" (addr)); + __asm__ __volatile__("lduh [%1], %0" + : "=r" (ret) + : "r" (addr)); return ret; } -static __inline__ unsigned short xf86ReadMmio16Le(void *base, const unsigned long offset) +static __inline__ unsigned short +xf86ReadMmio16Le(__volatile__ void *base, const unsigned long offset) { unsigned long addr = ((unsigned long)base) + offset; unsigned short ret; - __asm__ __volatile__("lduha [%1] %2, %0" : "=r" (ret) : "r" (addr), "i" (ASI_PL)); + __asm__ __volatile__("lduha [%1] %2, %0" + : "=r" (ret) + : "r" (addr), "i" (ASI_PL)); return ret; } -static __inline__ unsigned int xf86ReadMmio32Be(void *base, const unsigned long offset) +static __inline__ unsigned int +xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset) { unsigned long addr = ((unsigned long)base) + offset; unsigned int ret; - __asm__ __volatile__("ld [%1], %0" : "=r" (ret) : "r" (addr)); + __asm__ __volatile__("ld [%1], %0" + : "=r" (ret) + : "r" (addr)); return ret; } -static __inline__ unsigned int xf86ReadMmio32Le(void *base, const unsigned long offset) +static __inline__ unsigned int +xf86ReadMmio32Le(__volatile__ void *base, const unsigned long offset) { unsigned long addr = ((unsigned long)base) + offset; unsigned int ret; - __asm__ __volatile__("lda [%1] %2, %0" : "=r" (ret) : "r" (addr), "i" (ASI_PL)); + __asm__ __volatile__("lda [%1] %2, %0" + : "=r" (ret) + : "r" (addr), "i" (ASI_PL)); return ret; } -static __inline__ void xf86WriteMmio8(void *base, const unsigned long offset, - const unsigned int val) +static __inline__ void +xf86WriteMmio8(__volatile__ void *base, const unsigned long offset, + const unsigned int val) { unsigned long addr = ((unsigned long)base) + offset; @@ -554,8 +588,9 @@ static __inline__ void xf86WriteMmio8(void *base, const unsigned long offset, barrier(); } -static __inline__ void xf86WriteMmio16Be(void *base, const unsigned long offset, - const unsigned int val) +static __inline__ void +xf86WriteMmio16Be(__volatile__ void *base, const unsigned long offset, + const unsigned int val) { unsigned long addr = ((unsigned long)base) + offset; @@ -565,8 +600,9 @@ static __inline__ void xf86WriteMmio16Be(void *base, const unsigned long offset, barrier(); } -static __inline__ void xf86WriteMmio16Le(void *base, const unsigned long offset, - const unsigned int val) +static __inline__ void +xf86WriteMmio16Le(__volatile__ void *base, const unsigned long offset, + const unsigned int val) { unsigned long addr = ((unsigned long)base) + offset; @@ -576,8 +612,9 @@ static __inline__ void xf86WriteMmio16Le(void *base, const unsigned long offset, barrier(); } -static __inline__ void xf86WriteMmio32Be(void *base, const unsigned long offset, - const unsigned int val) +static __inline__ void +xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset, + const unsigned int val) { unsigned long addr = ((unsigned long)base) + offset; @@ -587,8 +624,9 @@ static __inline__ void xf86WriteMmio32Be(void *base, const unsigned long offset, barrier(); } -static __inline__ void xf86WriteMmio32Le(void *base, const unsigned long offset, - const unsigned int val) +static __inline__ void +xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset, + const unsigned int val) { unsigned long addr = ((unsigned long)base) + offset; @@ -598,8 +636,9 @@ static __inline__ void xf86WriteMmio32Le(void *base, const unsigned long offset, barrier(); } -static __inline__ void xf86WriteMmio8NB(void *base, const unsigned long offset, - const unsigned int val) +static __inline__ void +xf86WriteMmio8NB(__volatile__ void *base, const unsigned long offset, + const unsigned int val) { unsigned long addr = ((unsigned long)base) + offset; @@ -608,8 +647,9 @@ static __inline__ void xf86WriteMmio8NB(void *base, const unsigned long offset, : "r" (val), "r" (addr), "i" (ASI_PL)); } -static __inline__ void xf86WriteMmio16BeNB(void *base, const unsigned long offset, - const unsigned int val) +static __inline__ void +xf86WriteMmio16BeNB(__volatile__ void *base, const unsigned long offset, + const unsigned int val) { unsigned long addr = ((unsigned long)base) + offset; @@ -618,8 +658,9 @@ static __inline__ void xf86WriteMmio16BeNB(void *base, const unsigned long offse : "r" (val), "r" (addr)); } -static __inline__ void xf86WriteMmio16LeNB(void *base, const unsigned long offset, - const unsigned int val) +static __inline__ void +xf86WriteMmio16LeNB(__volatile__ void *base, const unsigned long offset, + const unsigned int val) { unsigned long addr = ((unsigned long)base) + offset; @@ -628,8 +669,9 @@ static __inline__ void xf86WriteMmio16LeNB(void *base, const unsigned long offse : "r" (val), "r" (addr), "i" (ASI_PL)); } -static __inline__ void xf86WriteMmio32BeNB(void *base, const unsigned long offset, - const unsigned int val) +static __inline__ void +xf86WriteMmio32BeNB(__volatile__ void *base, const unsigned long offset, + const unsigned int val) { unsigned long addr = ((unsigned long)base) + offset; @@ -638,8 +680,9 @@ static __inline__ void xf86WriteMmio32BeNB(void *base, const unsigned long offse : "r" (val), "r" (addr)); } -static __inline__ void xf86WriteMmio32LeNB(void *base, const unsigned long offset, - const unsigned int val) +static __inline__ void +xf86WriteMmio32LeNB(__volatile__ void *base, const unsigned long offset, + const unsigned int val) { unsigned long addr = ((unsigned long)base) + offset; @@ -766,19 +809,19 @@ outl(unsigned short port, unsigned int val) static __inline__ unsigned int inb(unsigned short port) { - return(*(volatile unsigned char*)(((unsigned short)(port))+IOPortBase)); + return *(volatile unsigned char*)(((unsigned short)(port))+IOPortBase); } static __inline__ unsigned int inw(unsigned short port) { - return(*(volatile unsigned short*)(((unsigned short)(port))+IOPortBase)); + return *(volatile unsigned short*)(((unsigned short)(port))+IOPortBase); } static __inline__ unsigned int inl(unsigned short port) { - return(*(volatile unsigned int*)(((unsigned short)(port))+IOPortBase)); + return *(volatile unsigned int*)(((unsigned short)(port))+IOPortBase); } @@ -853,7 +896,7 @@ extern volatile unsigned char *ioBase; #define eieio() __asm__ __volatile__ ("eieio") static __inline__ unsigned char -xf86ReadMmio8(void *base, const unsigned long offset) +xf86ReadMmio8(__volatile__ void *base, const unsigned long offset) { register unsigned char val; __asm__ __volatile__( @@ -862,11 +905,11 @@ xf86ReadMmio8(void *base, const unsigned long offset) : "=r" (val) : "b" (base), "r" (offset), "m" (*((volatile unsigned char *)base+offset))); - return(val); + return val; } static __inline__ unsigned short -xf86ReadMmio16Be(void *base, const unsigned long offset) +xf86ReadMmio16Be(__volatile__ void *base, const unsigned long offset) { register unsigned short val; __asm__ __volatile__( @@ -875,11 +918,11 @@ xf86ReadMmio16Be(void *base, const unsigned long offset) : "=r" (val) : "b" (base), "r" (offset), "m" (*((volatile unsigned char *)base+offset))); - return(val); + return val; } static __inline__ unsigned short -xf86ReadMmio16Le(void *base, const unsigned long offset) +xf86ReadMmio16Le(__volatile__ void *base, const unsigned long offset) { register unsigned short val; __asm__ __volatile__( @@ -888,11 +931,11 @@ xf86ReadMmio16Le(void *base, const unsigned long offset) : "=r" (val) : "b" (base), "r" (offset), "m" (*((volatile unsigned char *)base+offset))); - return(val); + return val; } static __inline__ unsigned int -xf86ReadMmio32Be(void *base, const unsigned long offset) +xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset) { register unsigned int val; __asm__ __volatile__( @@ -901,11 +944,11 @@ xf86ReadMmio32Be(void *base, const unsigned long offset) : "=r" (val) : "b" (base), "r" (offset), "m" (*((volatile unsigned char *)base+offset))); - return(val); + return val; } static __inline__ unsigned int -xf86ReadMmio32Le(void *base, const unsigned long offset) +xf86ReadMmio32Le(__volatile__ void *base, const unsigned long offset) { register unsigned int val; __asm__ __volatile__( @@ -914,12 +957,12 @@ xf86ReadMmio32Le(void *base, const unsigned long offset) : "=r" (val) : "b" (base), "r" (offset), "m" (*((volatile unsigned char *)base+offset))); - return(val); + return val; } static __inline__ void -xf86WriteMmioNB8(void *base, const unsigned long offset, - const unsigned char val) +xf86WriteMmioNB8(__volatile__ void *base, const unsigned long offset, + const unsigned char val) { __asm__ __volatile__( "stbx %1,%2,%3\n\t" @@ -928,8 +971,8 @@ xf86WriteMmioNB8(void *base, const unsigned long offset, } static __inline__ void -xf86WriteMmioNB16Le(void *base, const unsigned long offset, - const unsigned short val) +xf86WriteMmioNB16Le(__volatile__ void *base, const unsigned long offset, + const unsigned short val) { __asm__ __volatile__( "sthbrx %1,%2,%3\n\t" @@ -938,8 +981,8 @@ xf86WriteMmioNB16Le(void *base, const unsigned long offset, } static __inline__ void -xf86WriteMmioNB16Be(void *base, const unsigned long offset, - const unsigned short val) +xf86WriteMmioNB16Be(__volatile__ void *base, const unsigned long offset, + const unsigned short val) { __asm__ __volatile__( "sthx %1,%2,%3\n\t" @@ -948,8 +991,8 @@ xf86WriteMmioNB16Be(void *base, const unsigned long offset, } static __inline__ void -xf86WriteMmioNB32Le(void *base, const unsigned long offset, - const unsigned int val) +xf86WriteMmioNB32Le(__volatile__ void *base, const unsigned long offset, + const unsigned int val) { __asm__ __volatile__( "stwbrx %1,%2,%3\n\t" @@ -958,8 +1001,8 @@ xf86WriteMmioNB32Le(void *base, const unsigned long offset, } static __inline__ void -xf86WriteMmioNB32Be(void *base, const unsigned long offset, - const unsigned int val) +xf86WriteMmioNB32Be(__volatile__ void *base, const unsigned long offset, + const unsigned int val) { __asm__ __volatile__( "stwx %1,%2,%3\n\t" @@ -968,42 +1011,42 @@ xf86WriteMmioNB32Be(void *base, const unsigned long offset, } static __inline__ void -xf86WriteMmio8(void *base, const unsigned long offset, +xf86WriteMmio8(__volatile__ void *base, const unsigned long offset, const unsigned char val) { - xf86WriteMmioNB8(base,offset,val); + xf86WriteMmioNB8(base, offset, val); eieio(); } static __inline__ void -xf86WriteMmio16Le(void *base, const unsigned long offset, +xf86WriteMmio16Le(__volatile__ void *base, const unsigned long offset, const unsigned short val) { - xf86WriteMmioNB16Le(base,offset,val); + xf86WriteMmioNB16Le(base, offset, val); eieio(); } static __inline__ void -xf86WriteMmio16Be(void *base, const unsigned long offset, +xf86WriteMmio16Be(__volatile__ void *base, const unsigned long offset, const unsigned short val) { - xf86WriteMmioNB16Be(base,offset,val); + xf86WriteMmioNB16Be(base, offset, val); eieio(); } static __inline__ void -xf86WriteMmio32Le(void *base, const unsigned long offset, +xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset, const unsigned int val) { - xf86WriteMmioNB32Le(base,offset,val); + xf86WriteMmioNB32Le(base, offset, val); eieio(); } static __inline__ void -xf86WriteMmio32Be(void *base, const unsigned long offset, +xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset, const unsigned int val) { - xf86WriteMmioNB32Be(base,offset,val); + xf86WriteMmioNB32Be(base, offset, val); eieio(); } @@ -1012,42 +1055,42 @@ static __inline__ void outb(unsigned short port, unsigned char value) { if(ioBase == MAP_FAILED) return; - xf86WriteMmio8((void *)ioBase,port,value); + xf86WriteMmio8((void *)ioBase, port, value); } static __inline__ void outw(unsigned short port, unsigned short value) { if(ioBase == MAP_FAILED) return; - xf86WriteMmio16Le((void *)ioBase,port,value); + xf86WriteMmio16Le((void *)ioBase, port, value); } static __inline__ void outl(unsigned short port, unsigned int value) { if(ioBase == MAP_FAILED) return; - xf86WriteMmio32Le((void *)ioBase,port,value); + xf86WriteMmio32Le((void *)ioBase, port, value); } static __inline__ unsigned int inb(unsigned short port) { - if(ioBase == MAP_FAILED) return(0); - return(xf86ReadMmio8((void *)ioBase, port)); + if(ioBase == MAP_FAILED) return 0; + return xf86ReadMmio8((void *)ioBase, port); } static __inline__ unsigned int inw(unsigned short port) { - if(ioBase == MAP_FAILED) return(0); - return(xf86ReadMmio16Le((void *)ioBase, port)); + if(ioBase == MAP_FAILED) return 0; + return xf86ReadMmio16Le((void *)ioBase, port); } static __inline__ unsigned int inl(unsigned short port) { - if(ioBase == MAP_FAILED) return(0); - return(xf86ReadMmio32Le((void *)ioBase, port)); + if(ioBase == MAP_FAILED) return 0; + return xf86ReadMmio32Le((void *)ioBase, port); } #define ldq_u(p) ldl_u(p) @@ -1431,7 +1474,7 @@ rdinx(unsigned short port, unsigned char ind) if (port == 0x3C0) /* reset attribute flip-flop */ (void) inb(0x3DA); outb(port, ind); - return(inb(port+1)); + return inb(port+1); } /* @@ -1474,7 +1517,7 @@ testrg(unsigned short port, unsigned char mask) outb(port, old | mask); new2 = inb(port) & mask; outb(port, old); - return((new1 == 0) && (new2 == mask)); + return (new1 == 0) && (new2 == mask); } /* @@ -1492,7 +1535,7 @@ testinx2(unsigned short port, unsigned char ind, unsigned char mask) wrinx(port, ind, old | mask); new2 = rdinx(port, ind) & mask; wrinx(port, ind, old); - return((new1 == 0) && (new2 == mask)); + return (new1 == 0) && (new2 == mask); } /* @@ -1502,7 +1545,7 @@ testinx2(unsigned short port, unsigned char ind, unsigned char mask) static __inline__ int testinx(unsigned short port, unsigned char ind) { - return(testinx2(port, ind, 0xFF)); + return testinx2(port, ind, 0xFF); } #endif /* COMPILER_H_EXTRAS */ diff --git a/xc/programs/Xserver/hw/xfree86/common/modeline2c.pl b/xc/programs/Xserver/hw/xfree86/common/modeline2c.pl index cd82341b3..d33048c32 100644 --- a/xc/programs/Xserver/hw/xfree86/common/modeline2c.pl +++ b/xc/programs/Xserver/hw/xfree86/common/modeline2c.pl @@ -10,9 +10,9 @@ # hackish perl - author Dirk Hohndel # Copyright 1999-2001 by The XFree86 Project, Inc. # -# $XFree86: xc/programs/Xserver/hw/xfree86/common/modeline2c.pl,v 1.6 2001/02/15 18:20:33 dawes Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/common/modeline2c.pl,v 1.7 2001/04/07 00:50:15 dawes Exp $ -my %flagshash; +#my %flagshash; $flagshash{""} = "0"; # $flagshash{"Interlace"} = "V_INTERLACE"; # $flagshash{"+hsync"} = "V_PHSYNC"; @@ -31,7 +31,7 @@ $flagshash{"-hsync -vsync interlace"} = "V_NHSYNC | V_NVSYNC | V_INTERLACE"; # stop CVS from expanding the XFree86 Id here... -my $proj = "XFree86"; +$proj = "XFree86"; printf("/* \$$proj: \$ */ /* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at @@ -62,9 +62,9 @@ while (<>) { print "/*" . $_ . " */\n"; } if (/^ModeLine\s+(\S+)\s+([\d.\s]+)(.*)/i) { - my $name = $1; - my $values = $2; - my $flags = $3; + $name = $1; + $values = $2; + $flags = $3; $flags =~ y/A-Z/a-z/; $values =~ /([\d.]+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/; printf("\t{MODEPREFIX(%s),%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n", diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c b/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c index a3e74e889..3a7369d66 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.53 2001/02/15 20:31:49 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.54 2001/04/10 16:07:58 dawes Exp $ */ /* * Copyright 2000 by Alan Hourihane, Sychdyn, North Wales. * @@ -586,7 +586,9 @@ configureModuleSection (void) module = xf86confmalloc(sizeof(XF86LoadRec)); memset((XF86LoadPtr)module,0,sizeof(XF86LoadRec)); module->load_name = *el; - ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem( + /* HACK, remove GLcore, glx, loads it as a submodule */ + if (strcmp(*el, "GLcore")) + ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem( (glp)ptr->mod_load_lst, (glp)module); } xfree(elist); diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Events.c b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c index 75badb64b..2c68e4bc3 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.107 2001/03/08 00:40:42 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.108 2001/04/20 16:32:30 tsi Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -857,7 +857,13 @@ special: * normal, non-keypad keys */ if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) { -#if !defined(CSRG_BASED) && !defined(MACH386) && !defined(MINIX) && !defined(__OSF__) && !defined(__GNU__) +#if !defined(CSRG_BASED) && \ + !defined(MACH386) && \ + !defined(MINIX) && \ + !defined(__OSF__) && \ + !defined(__GNU__) && \ + !defined(__CYGWIN__) && \ + defined(KB_84) /* * magic ALT_L key on AT84 keyboards for multilingual support */ diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Io.c b/xc/programs/Xserver/hw/xfree86/common/xf86Io.c index 4b2e731a4..f76c1123e 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Io.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Io.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Io.c,v 3.41 2000/11/06 19:24:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Io.c,v 3.42 2001/04/20 16:32:30 tsi Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -396,7 +396,7 @@ xf86KbdProc (pKeyboard, what) return (Success); } -#if !defined(AMOEBA) && !(defined (sun) && defined(i386) && defined (SVR4)) && !defined(MINIX) && !(defined(__mips__) && !defined(linux)) && !defined(QNX4) +#if defined(DDXTIME) && !defined(QNX4) /* * These are getting tossed in here until I can think of where * they really belong @@ -409,7 +409,7 @@ GetTimeInMillis() gettimeofday(&tp, 0); return(tp.tv_sec * 1000) + (tp.tv_usec / 1000); } -#endif /* !AMOEBA && !(sun || SVR4) && !MINIX */ +#endif /* DDXTIME && !QNX4 */ #ifdef WSCONS_SUPPORT diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h b/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h index a1aa5ecdc..fce49fa81 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.94 2001/04/05 21:29:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.95 2001/04/17 20:46:39 dawes Exp $ */ /* * PCI Probe * @@ -517,6 +517,9 @@ #define PCI_CHIP_VOODOO3 0x0005 #define PCI_CHIP_VOODOO5 0x0009 +#define PCI_CARD_VOODOO3_2000 0x0036 +#define PCI_CARD_VOODOO3_3000 0x003a + /* Rendition */ #define PCI_CHIP_V1000 0x0001 #define PCI_CHIP_V2x00 0x2000 @@ -1642,6 +1645,10 @@ static pciVendorCardInfo xf86PCICardInfoData[] = { { 0x3d32, "Jeronimo 2000",0, NF }, { 0x3db3, "Jeronimo Pro",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, + { PCI_VENDOR_3DFX, { + { PCI_CARD_VOODOO3_2000, "Voodoo3 2000",0, NF }, + { PCI_CARD_VOODOO3_3000, "Voodoo3 3000",0, NF }, + { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_3DLABS, { { 0x0096, "Permedia",0, NF }, { 0x0098, "PermediaNT",0, NF }, diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h b/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h index 08b8e2d85..578ec9ce7 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.23 2001/03/05 20:18:21 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.24 2001/04/20 16:32:30 tsi Exp $ */ /* * Copyright (c) 1997,1998 by The XFree86 Project, Inc. @@ -14,8 +14,6 @@ #include "Xproto.h" #include "xf86Pci.h" -#ifdef XINPUT -#endif /* PCI probe flags */ diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Switch.c b/xc/programs/Xserver/hw/xfree86/common/xf86Switch.c index cbcfb83a2..d11ab417a 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Switch.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Switch.c @@ -21,14 +21,10 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Switch.c,v 3.8 1999/05/07 02:56:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Switch.c,v 3.9 2001/04/20 16:32:31 tsi Exp $ */ -#if !defined(sun) || defined(i386) #include "xf86.h" #include "xf86Xinput.h" -#else -#include "extio.h" -#endif /****************************************************************************** * debugging macro diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h b/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h index c8a7fb00b..f5b9b5d80 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.33 2001/03/04 01:37:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.34 2001/04/16 21:08:24 herrb Exp $ */ #ifndef _xf86Xinput_h #define _xf86Xinput_h @@ -70,6 +70,7 @@ #endif #define HAS_MOTION_HISTORY(local) ((local)->dev->valuator && (local)->dev->valuator->numMotionEvents) +#ifdef XINPUT /* This holds the input driver entry and module information. */ typedef struct _InputDriverRec { int driverVersion; @@ -83,7 +84,7 @@ typedef struct _InputDriverRec { pointer module; int refCount; } InputDriverRec, *InputDriverPtr; - +#endif /* This is to input devices what the ScrnInfoRec is to screens. */ diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86str.h b/xc/programs/Xserver/hw/xfree86/common/xf86str.h index 88d574924..b5739aa60 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86str.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86str.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.75 2001/01/06 20:19:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.76 2001/04/10 16:07:58 dawes Exp $ */ /* * Copyright (c) 1997-2000 by The XFree86 Project, Inc. @@ -87,9 +87,9 @@ typedef enum { MODE_VBLANK_WIDE, /* vertical blanking too wide */ MODE_PANEL, /* exceeds panel dimensions */ MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */ - MODE_ONE_WIDTH, /* only one width is supported */ - MODE_ONE_HEIGHT, /* only one height is supported */ - MODE_ONE_SIZE, /* only one resolution is supported */ + MODE_ONE_WIDTH, /* only one width is supported */ + MODE_ONE_HEIGHT, /* only one height is supported */ + MODE_ONE_SIZE, /* only one resolution is supported */ MODE_BAD = -2, /* unspecified reason */ MODE_ERROR = -1 /* error condition */ } ModeStatus; diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h b/xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h index fe3320607..768eb0acb 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h @@ -1,9 +1,9 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h,v 1.3 2001/04/01 14:00:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h,v 1.4 2001/04/08 23:00:27 alanh Exp $ */ #ifndef _XF86XVMC_H #define _XF86XVMC_H -#include "xvmc.h" +#include "xvmcext.h" #include "xf86xv.h" typedef struct { diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.DRI b/xc/programs/Xserver/hw/xfree86/doc/README.DRI index 15794df56..5509f502b 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.DRI +++ b/xc/programs/Xserver/hw/xfree86/doc/README.DRI @@ -8,7 +8,7 @@ 1.1 Copyright -Copyright 2000-2001 by VA Linux Systems, Inc. All Rights Reserved. +Copyright © 2000-2001 by VA Linux Systems, Inc. All Rights Reserved. Permission is granted to make and distribute verbatim copies of this document provided the copyright notice and this permission notice are preserved on all @@ -50,12 +50,8 @@ inux.com. 3. Supported Architectures & Hardware - " - 3.1 CPU Architectures - " - The architectures currently supported by the DRI have grown from the initial Intel i386 systems to now include the Alpha Processor and the Sun SPARC machines. @@ -76,8 +72,6 @@ performance. See the DRI Compilation Guide for details. 3.2 Graphics Hardware - " - XFree86 4.0 (or later versions) includes 3D acceleration for the following graphics hardware: @@ -164,8 +158,6 @@ may not be answerable. 5. Kernel Modules - " - 3D hardware acceleration requires a DRI kernel module that's specific to your graphics hardware. @@ -192,8 +184,6 @@ X server startup log, and checking that /proc/dri/0 exists. 6. XF86Config file - " - The XFree86 configuration file is usually found in /etc/X11/XF86Config. This section describes the parts which must be specially set for the DRI. @@ -431,7 +421,7 @@ card. This will indicate whether or not bus mastering is enabled. setpci -s 01:00.0 4.w -A hexidecimal value will be printed. Convert the least significant digit to +A hexadecimal value will be printed. Convert the least significant digit to binary. For example, if you see 3, that's 0011 in binary (bit two is 0). If you see 7, that's 0111 in binary (bit two is 1). In the first example, bus mastering is disabled. It's enabled in the second example. @@ -755,20 +745,14 @@ A software-based accumulation buffer is available in both 16 and 32bpp modes. 10.2 Intel i810 - " - 10.2.1 Dependencies - " - A Linux kernel with AGP GART support is required. The 2.2.x kernel series does not have AGP GART support. The 2.4.x test kernels have AGP GART and have been tested with the i810. 10.2.2 Configuration - " - Your XF86Config file's device section must specify the i810 device, and spec- ify a usable amount of video ram to reserve. @@ -818,19 +802,13 @@ ules/dri/i810_dri.so. This will be automatically loaded by libGL.so. 10.3 Matrox G200 and G400 - " - 10.3.1 Dependencies - " - A Linux kernel with AGP GART support (such as the 2.4.x test kernels) is needed. 10.3.2 Configuration - " - Your XF86Config file's device section must specify the mga device: Section "Device" @@ -900,6 +878,23 @@ Software rendering will be used under any of the following conditions: The AGP mode may be set to 1, 2, or 4. One is used by default. Higher AGP speeds may result in unreliable performance depending on your motherboard. +Compaq has funded the implementation of AGP acclerated ReadPixels and Draw- +Pixels in this driver. With this implementation, on a G400 drawing directly +from AGP memory (exported to the client), throughput of up to 1 GB/sec has +been measured. + +Additionally Compaq's funding has produced several new extensions in Mesa, +including one (packed_depth_stencil_MESA) which enables Read/DrawPixels func- +tionality to operate directly on the packed 24/8 depth/stencil buffers of +this hardware. + +In order to access this functionality, the application must ensure that all +pixel processing operations are disabled. There are in addition a fairly +complex set of rules regarding which packing/unpacking modes must be used, +and which data formats are supported, and alignment constraints. See the +files in lib/GL/mesa/src/drv/mga/DOCS for a summary of these. The extension +definitions are included in the Mesa 3.4 source distribution. + 10.3.4 IRQ Assignment There have been problems in the past with the MGA driver being very sluggish @@ -943,19 +938,13 @@ None. 10.4 ATI Rage 128 - " - 10.4.1 Dependencies - " - A Linux kernel with AGP GART support (such as the 2.4.x test kernels) is needed. 10.4.2 Configuration - " - Your XF86Config file's device section must specify the ati device: Section "Device" @@ -1011,19 +1000,13 @@ Performance will be degraded, of course. 10.5 ATI Radeon - " - 10.5.1 Dependencies - " - A Linux kernel with AGP GART support (such as the 2.4.x test kernels) is needed. 10.5.2 Configuration - " - Your XF86Config file's device section must specify the ati device: Section "Device" @@ -1187,7 +1170,7 @@ forge.net/resources/resources.html o In the future there may be IHV and Linux vendor support resources for the DRI. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.17 2001/03/21 16:56:18 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.21 2001/04/10 16:07:58 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRI,v 1.14 2001/03/25 05:42:43 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRI,v 1.15 2001/04/10 16:44:31 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp b/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp index 921d53457..c37706cf9 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp +++ b/xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp @@ -8,7 +8,7 @@ 1.1 Copyright -Copyright 2000-2001 by VA Linux Systems, Inc. All Rights Reserved. +Copyright © 2000-2001 by VA Linux Systems, Inc. All Rights Reserved. Permission is granted to make and distribute verbatim copies of this document provided the copyright notice and this permission notice are preserved on all @@ -114,7 +114,7 @@ Here are the basic steps for kernel setup. o Read /usr/src/linux/Documentation/Changes. This file lists the minimum requirements for all software packages required to build the kernel. - You must upgrage at least gcc, make, binutils and modutils to at least + You must upgrade at least gcc, make, binutils and modutils to at least the versions specified in this file. The other packages may not be needed. If you are upgrading from Linux 2.2.x you must upgrade your modutils package for Linux 2.4.x. @@ -187,8 +187,6 @@ should be used and enable them where appropriate. 5.1 Intel Pentium III Features - " - The Pentium III SSE (Katmai) instructions are used in optimized vertex trans- formation functions in the Mesa-based DRI drivers. On Linux, SSE requires a recent kernel (such as 2.4.0-test11 or later) both at compile time and run- @@ -196,16 +194,12 @@ time. 5.2 AMD 3DNow! Features - " - AMD's 3DNow! instructions are used in optimized vertex transformation func- tions in the Mesa-based DRI drivers. 3DNow! is supported in most versions of Linux. 5.3 Alpha Features - " - On newer Alpha processors a significant performance increase can be seen with the addition of the -mcpu= option to GCC. This option is dependent on the architecture of the processor. For example, -mcpu=ev6 will build specifi- @@ -601,7 +595,7 @@ At this point your X server should be up and running with hardware-acceler- ated direct rendering. Please read the DRI User Guide for information about trouble shooting and how to use the DRI-enabled X server for 3D applications. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.11 2001/03/21 16:56:18 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.13 2001/04/05 19:29:42 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp,v 3.8 2001/03/25 05:42:43 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp,v 3.9 2001/04/10 16:44:31 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD b/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD index 452164dda..bc01998fe 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD +++ b/xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD @@ -34,7 +34,7 @@ if you have comments or suggestions about this file and we'll revise it. See the Release Notes for non-OS dependent new features in XFree86 4.0.2. -3.1 New OS dependant features in 4.0.3 +3.1 New OS dependent features in 4.0.3 o Support for the wscons console driver in post 2.8 OpenBSD. @@ -332,7 +332,7 @@ Many thanks to all people who contributed to make XFree86 work on *BSD, in particular, David Dawes, Pace Willison, Amancio Hasty, Christoph Robitschko, Nate Williams, Rod Grimes, Jack Velte and Michael Smith. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.16 2001/03/04 09:47:35 herrb Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.17 2001/04/05 19:29:43 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD,v 1.21 2001/03/04 09:48:47 herrb Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD,v 1.22 2001/04/10 16:44:31 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.ati b/xc/programs/Xserver/hw/xfree86/doc/README.ati index 19b525acb..af39d20db 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.ati +++ b/xc/programs/Xserver/hw/xfree86/doc/README.ati @@ -2,7 +2,7 @@ Marc Aurele La France - 2001 March 24 + 2001 April 10 Abstract @@ -438,7 +438,15 @@ rently, these options are only acted upon for 256-colour or higher depth modes, if a Mach64 accelerator CRTC, or a Mach64 integrated controller is being used. In all other situations, a software cursor will be used. -5.11 Option ``shadowfb'' +5.11 Option ``SilkenMouse'' + +This option is only acted upon when a hardware cursor is being used. It +specifies that the cursor's position on the screen is to be updated as +quickly as possible when the mouse is moved. This is the default behaviour. +If this option is negated, the cursor may lag the mouse when the X server is +very busy. + +5.12 Option ``shadowfb'' If this option is enabled, the driver will cause the CPU to do each drawing operation first into a shadow frame buffer in system virtual memory and then @@ -454,19 +462,19 @@ Note that, due to various limitations, this option is forcibly disabled when a linear video memory aperture is not enabled, when the frame buffer depth is less than 8, or when acceleration is used. -5.12 Option ``dpms'' +5.13 Option ``dpms'' This option enables the driver's support for VESA's Display Power Management Specification. -5.13 Option ``backingstore'' +5.14 Option ``backingstore'' This is not specifically a driver option. It is used to enable the server's support for backing store, a mechanism by which pixel data for occluded win- dow regions is remembered by the server thereby alleviating the need to send expose events to X clients when the data needs to be redisplayed. -5.14 MemBase address +5.15 MemBase address This specification is only effective for non-PCI Mach64 adapters, and is used to override the CPU address at which the adapter will map its video memory. @@ -480,14 +488,14 @@ ing to the PCI Plug'n'Play specification which arbitrates the resource requirements of most devices in the system. This means the driver can not easily change the linear aperture address. -5.15 Option ``ReferenceClock'' ``frequency'' +5.16 Option ``ReferenceClock'' ``frequency'' This option is only applicable to non-Intel platforms, where an adapter BIOS is not available to the driver. The option specifies the reference frequency used by the adapter's clock generator. The default is 14.318 MHz, and other typical values are 28.636, or 29.5 MHz. -5.16 ClockChip ``name'' +5.17 ClockChip ``name'' This option is only applicable to non-Intel platforms, where an adapter BIOS is not available to the driver, and the driver cannot reliably determine @@ -683,7 +691,7 @@ newer driver API of XFree86 4.0 and later. The introduction of version 6 is a first swipe at porting the driver to non- Intel architectures. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.36 2001/03/25 05:32:07 tsi Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.37 2001/04/16 15:02:08 tsi Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.ati,v 3.55 2001/03/25 05:42:43 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.ati,v 3.56 2001/04/16 15:06:49 tsi Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/README.i810 b/xc/programs/Xserver/hw/xfree86/doc/README.i810 index 7807628d9..cee453c26 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/README.i810 +++ b/xc/programs/Xserver/hw/xfree86/doc/README.i810 @@ -14,6 +14,8 @@ o i810e + o i815 + 2. Features o Full support for 8, 15, 16, and 24 bit pixel depths. @@ -36,13 +38,13 @@ o Interlace modes cannot be supported. - o This driver currently only works for Linux/ix86, and normal use requires - the agpgart.o kernel module, included in Linux kernels 2.3.42 and - higher. + o This driver currently only works for Linux/ix86 and recent versions of + FreeBSD. It requires the agpgart kernel support, which is included in + Linux kernels 2.3.42 and higher, and FreeBSD 4.1 and higher. 4. Reported Working Video Cards - o Intel evaluation hardware - i810, i810-dc100 and i810e. + o Intel evaluation hardware - i810, i810-dc100, i810e and i815. o Tyan Tomcat Motherboard. @@ -104,7 +106,7 @@ This driver was donated to The XFree86 Project by: http://www.precisioninsight.com - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml,v 1.2 2000/03/04 00:00:30 dawes Exp $ + 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.5 2000/12/01 19:47:49 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.i810,v 1.6 2001/04/10 16:44:32 dawes Exp $ diff --git a/xc/programs/Xserver/hw/xfree86/doc/Status b/xc/programs/Xserver/hw/xfree86/doc/Status index 0e05bc4ce..bc8b7fa42 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/Status +++ b/xc/programs/Xserver/hw/xfree86/doc/Status @@ -8,10 +8,9 @@ This document provides information about the status of the driver and hardware support in XFree86 4.0.2 compared with that in XFree86 - 3.3.6. Unless otherwise stated, hardware is classified as "sup- - ported" if its driver provides basic 2D support. Support for addi- - tional features may or may not be present. Please send updates for - this document to <fixes@xfree86.org> + 3.3.6. Please send updates for this document to + <fixes@xfree86.org>. Please do not send requests for information + or support to that address. 1. Introduction @@ -19,7 +18,9 @@ This document contains one section per vendor (organised alphabetically) for each chipset family that is supported in XFree86 3.3.6 or XFree86 4.0.2. It includes information about the status of the drivers and the hardware they support, including a comparison of the level of support between versions -3.3.6 and 4.0.2. +3.3.6 and 4.0.2. Unless otherwise stated, hardware is classified as "sup- +ported" if its driver provides basic 2D support. Support for additional fea- +tures may or may not be present. In XFree86 3.3.6, several X servers are available; much hardware uses the XF86_SVGA server, which has a set of driver modules that are built into it at @@ -307,13 +308,15 @@ architectures known to work on (e.g., Alpha, PPC), etc. 4.0.2: Support (accelerated) for the Intel i740 is provided by the - "i740" driver, and support for the Intel i810 is provided by the - "i810" driver. The "i810" driver is currently Linux-only, and - requires the agpgart.o kernel module. + "i740" driver, and support for the Intel i810 (including + i810-dc100 and i810e) and i815 is provided by the "i810" driver. + The "i810" driver is currently supported only on Linux and + FreeBSD (4.1 and later), and requires the agpgart kernel support. Summary: The i740 and i810 are supported in both versions, but the i810 is - only supported on Linux/x86 platforms at present. + only supported on Linux/x86 and recent FreeBSD/i386 platforms at + present. 18. Matrox @@ -629,7 +632,7 @@ architectures known to work on (e.g., Alpha, PPC), etc. Summary: No Weitek chips are supported in 4.0.2. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.28 2001/03/16 22:13:19 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.29 2001/04/04 01:34:18 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/Status,v 1.22 2001/03/25 05:42:43 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/Status,v 1.23 2001/04/10 16:44:32 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 16ebb560c..392439d35 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 March 2001 <ident> - $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.20 2001/04/05 19:29:42 dawes Exp $ + $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.21 2001/04/10 16:07:58 dawes Exp $ </ident> <toc> @@ -1047,6 +1047,31 @@ Higher AGP speeds may result in unreliable performance depending on your motherboard. +<p> + Compaq has funded the implementation of AGP acclerated + ReadPixels and DrawPixels in this driver. With this + implementation, on a G400 drawing directly from AGP memory + (exported to the client), throughput of up to 1 GB/sec has + been measured. + +<p> + Additionally Compaq's funding has produced several new + extensions in Mesa, including one (packed_depth_stencil_MESA) + which enables Read/DrawPixels functionality to operate + directly on the packed 24/8 depth/stencil buffers of this + hardware. + +<p> + In order to access this functionality, the application must + ensure that all pixel processing operations are disabled. + There are in addition a fairly complex set of rules regarding + which packing/unpacking modes must be used, and which data + formats are supported, and alignment constraints. See the + files in lib/GL/mesa/src/drv/mga/DOCS for a summary of these. + The extension definitions are included in the Mesa 3.4 source + distribution. + + <sect2>IRQ Assignment <p> There have been problems in the past with the MGA driver being very diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml index 44b2e0364..48762080a 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml @@ -8,14 +8,14 @@ <title>ATI Adapters README file <author>Marc Aurele La France -<date>2001 March 24 +<date>2001 April 10 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.36 2001/03/25 05:32:07 tsi Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.37 2001/04/16 15:02:08 tsi Exp $ </ident> <abstract> @@ -405,6 +405,13 @@ Currently, these options are only acted upon for 256-colour or higher depth modes, if a Mach64 accelerator CRTC, or a Mach64 integrated controller is being used. In all other situations, a software cursor will be used.<p> +<sect1>Option <it>``SilkenMouse''</it><p> +This option is only acted upon when a hardware cursor is being used. +It specifies that the cursor's position on the screen is to be updated as +quickly as possible when the mouse is moved. +This is the default behaviour. +If this option is negated, the cursor may lag the mouse when the X server is +very busy.<p> <sect1>Option <it>``shadowfb''</it><p> If this option is enabled, the driver will cause the CPU to do each drawing operation first into a shadow frame buffer in system virtual memory and then diff --git a/xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile index 11b1c376d..144b86384 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile,v 1.21 2001/01/24 00:06:15 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile,v 1.22 2001/04/25 17:46:42 alanh Exp $ #define IHaveModules #include <Server.tmpl> @@ -18,7 +18,7 @@ INCLUDES = -I. -I../../include #else INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ - -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa \ + -I$(SERVERSRC)/fb -I$(XF86SRC)/xaa \ -I$(XF86SRC)/xf1bpp -I$(XF86SRC)/xf4bpp \ -I$(XF86SRC)/xf24_32bpp \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h b/xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h index efc8533f7..1a5cf63dc 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h,v 1.15 2000/06/30 18:27:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h,v 1.16 2001/04/25 17:46:42 alanh Exp $ */ /* All drivers should typically include these */ @@ -33,18 +33,7 @@ #include "xf1bpp.h" #include "xf4bpp.h" -/* Drivers using cfb need this */ - -#define PSZ 8 -#include "cfb.h" -#undef PSZ - -/* Drivers supporting bpp 16, 24 or 32 with cfb need these */ - -#include "cfb16.h" -#include "cfb24.h" -#include "cfb32.h" -#include "cfb24_32.h" +#include "fb.h" /* Drivers using the XAA interface ... */ #include "xaa.h" diff --git a/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c index 75baca4fa..cfa8b3f40 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c,v 1.15 2001/01/06 21:29:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c,v 1.16 2001/04/25 17:46:42 alanh Exp $ */ #define COMPILER_H_EXTRAS @@ -159,7 +159,7 @@ ApmCopyAreaPixmap(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GC *pGC, register int Scanlines; int is; int id; - int sx, sy, dx, dy, pitch; + int sx = 0, sy = 0, dx = 0, dy = 0, pitch; RegionPtr pReg; if (APMPTR(xf86Screens[(pGC)->pScreen->myNum])->Chipset == AT3D) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c index f4341e2f1..77e033cab 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c,v 1.48 2001/01/21 21:19:17 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c,v 1.49 2001/04/25 17:46:42 alanh Exp $ */ #define COMPILER_H_EXTRAS #include "apm.h" @@ -54,7 +54,6 @@ static void ApmProbeDDC(ScrnInfoPtr pScrn, int index); int ApmPixmapIndex = -1; static int ApmGeneration = -1; -static int pix24bpp = 0; DriverRec APM = { VERSION, @@ -196,14 +195,11 @@ static const char *shadowSymbols[] = { #ifdef XFree86LOADER -static const char *cfbSymbols[] = { +static const char *fbSymbols[] = { "xf1bppScreenInit", "xf4bppScreenInit", - "cfbScreenInit", - "cfb16ScreenInit", - "cfb24ScreenInit", - "cfb32ScreenInit", - "cfb24_32ScreenInit", + "fbScreenInit", + "fbPictureInit", NULL }; @@ -237,7 +233,7 @@ apmSetup(pointer module, pointer opts, int *errmaj, int *errmain) setupDone = TRUE; xf86AddDriver(&APM, module, 0); - LoaderRefSymLists(vgahwSymbols, cfbSymbols, xaaSymbols, + LoaderRefSymLists(vgahwSymbols, fbSymbols, xaaSymbols, /*xf8_32bppSymbols,*/ ramdacSymbols, vbeSymbols, ddcSymbols, i2cSymbols, shadowSymbols, NULL); @@ -479,8 +475,6 @@ ddc1Read(ScrnInfoPtr pScrn) return (STATUS_IOP() & STATUS_SDA) != 0; } -extern xf86MonPtr ConfiguredMonitor; - static void ApmProbeDDC(ScrnInfoPtr pScrn, int index) { @@ -1047,25 +1041,11 @@ ApmPreInit(ScrnInfoPtr pScrn, int flags) req = "xf4bppScreenInit"; break; case 8: - mod = "cfb"; - req = "cfbScreenInit"; - break; case 16: - mod = "cfb16"; - req = "cfb16ScreenInit"; - break; case 24: - if (pix24bpp == 24) { - mod = "cfb24"; - req = "cfb24ScreenInit"; - } else { - mod = "xf24_32bpp"; - req = "cfb24_32ScreenInit"; - } - break; case 32: - mod = "cfb32"; - req = "cfb32ScreenInit"; + mod = "fb"; + req = "fbScreenInit"; break; } @@ -1802,25 +1782,7 @@ ApmScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) ApmAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); /* - * The next step is to setup the screen's visuals, and initialise the - * framebuffer code. In cases where the framebuffer's default - * choices for things like visual layouts and bits per RGB are OK, - * this may be as simple as calling the framebuffer's ScreenInit() - * function. If not, the visuals will need to be setup before calling - * a fb ScreenInit() function and fixed up after. - * - * XXX NOTE: cfbScreenInit() will not result in the default visual - * being set correctly when there is a screen-specific value given - * in the config file as opposed to a global value given on the - * command line. Saving and restoring 'defaultColorVisualClass' - * around the fb's ScreenInit() solves this problem. - * - * For most PC hardware at depths >= 8, the defaults that cfb uses - * are not appropriate. In this driver, we fixup the visuals after. - */ - - /* - * Reset cfb's visual list. + * Reset fb's visual list. */ miClearVisualTypes(); @@ -1862,6 +1824,8 @@ ApmScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) ApmHWCursorReserveSpace(pApm); ApmAccelReserveSpace(pApm); + miSetPixmapDepths(); + switch (pScrn->bitsPerPixel) { case 1: ret = xf1bppScreenInit(pScreen, FbBase, @@ -1876,31 +1840,14 @@ ApmScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScrn->displayWidth); break; case 8: - ret = cfbScreenInit(pScreen, FbBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - break; case 16: - ret = cfb16ScreenInit(pScreen, FbBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - break; case 24: - if (pix24bpp == 24) - ret = cfb24ScreenInit(pScreen, FbBase, - pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - else - ret = cfb24_32ScreenInit(pScreen, FbBase, - pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - break; case 32: - ret = cfb32ScreenInit(pScreen, FbBase, pScrn->virtualX, + ret = fbScreenInit(pScreen, FbBase, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); + pScrn->displayWidth, pScrn->bitsPerPixel); + if (ret) + fbPictureInit(pScreen, 0, 0); break; default: xf86DrvMsg(scrnIndex, X_ERROR, diff --git a/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c b/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c index 09b8b0feb..d8cae30fa 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c,v 1.7 2000/06/30 18:27:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c,v 1.8 2001/04/25 17:46:42 alanh Exp $ */ #if PSZ != 24 #include "dixstruct.h" @@ -548,7 +548,6 @@ static int A(ReputImage)(ScrnInfoPtr pScrn, short drw_x, short drw_y, RegionPtr clipBoxes, pointer data) { - ScreenPtr pScreen = pScrn->pScreen; APMDECL(pScrn); ApmPortPrivPtr pPriv = data, pPriv0, pPriv1; register int fx, fy; @@ -703,10 +702,10 @@ A(PutImage)(ScrnInfoPtr pScrn, short src_x, short src_y, APMDECL(pScrn); INT32 x1, x2, y1, y2; unsigned char *dst_start; - int pitch, Bpp, new_h, offset, offset2, offset3; + int pitch, Bpp, new_h, offset = 0, offset2 = 0, offset3 = 0; CARD32 mask; FBAreaPtr area; - int srcPitch, dstPitch, srcPitch2; + int srcPitch, dstPitch, srcPitch2 = 0; int top, left, npixels, nlines; BoxRec dstBox; CARD32 scalex, scaley, scale; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile index 756445cd1..910a11040 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile,v 1.29 2001/03/25 05:32:07 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile,v 1.30 2001/04/16 15:02:09 tsi Exp $ XCOMM XCOMM Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org XCOMM @@ -90,10 +90,10 @@ DRIDEFINES = $(GLX_DEFINES) #if !ATIAvoidCPIO -CPIOSRCS1 = atibios.c ativgaio.c +CPIOSRCS1 = ativgaio.c CPIOSRCS2 = atibank.c ativga.c atiwonder.c atiwonderio.c -CPIOOBJS1 = atibios.o ativgaio.o +CPIOOBJS1 = ativgaio.o CPIOOBJS2 = atibank.o ativga.o atiwonder.o atiwonderio.o #else @@ -183,8 +183,6 @@ InstallDriverSDKNonExecFile(atiadjust.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atiadjust.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atibank.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atibank.h,$(DRIVERSDKDIR)/drivers/ati) -InstallDriverSDKNonExecFile(atibios.c,$(DRIVERSDKDIR)/drivers/ati) -InstallDriverSDKNonExecFile(atibios.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atibus.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atibus.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atichip.c,$(DRIVERSDKDIR)/drivers/ati) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c index dcac2d8cf..4308ae8ae 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c,v 1.4 2001/04/04 00:19:04 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c,v 1.5 2001/04/16 15:47:56 tsi Exp $ */ /* * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -40,7 +40,7 @@ ATIInitializeAcceleration ) { BoxRec ScreenArea; - unsigned int scanlines; + unsigned int nScanlines, maxScanlines; if (!pATI->OptionAccel) return TRUE; @@ -51,27 +51,27 @@ ATIInitializeAcceleration switch (pATI->Adapter) { case ATI_ADAPTER_MACH64: - if (ATIMach64AccelInit(pATI, pATI->pXAAInfo)) - break; - /* Fall through */ + maxScanlines = ATIMach64AccelInit(pATI, pATI->pXAAInfo); + break; default: - XAADestroyInfoRec(pATI->pXAAInfo); - pATI->pXAAInfo = NULL; - return FALSE; + maxScanlines = 0; } - ScreenArea.x1 = ScreenArea.y1 = 0; - ScreenArea.x2 = pATI->displayWidth; - scanlines = pScreenInfo->videoRam * 1024 * 8 / pATI->displayWidth / - pATI->bitsPerPixel; - if (scanlines > ATIMach64MaxY) - scanlines = ATIMach64MaxY; - ScreenArea.y2 = (short int)scanlines; - xf86InitFBManager(pScreen, &ScreenArea); + if (maxScanlines > 0) + { + ScreenArea.x1 = ScreenArea.y1 = 0; + ScreenArea.x2 = pATI->displayWidth; + nScanlines = pScreenInfo->videoRam * 1024 * 8 / pATI->displayWidth / + pATI->bitsPerPixel; + if (nScanlines > maxScanlines) + nScanlines = maxScanlines; + ScreenArea.y2 = (short int)nScanlines; + xf86InitFBManager(pScreen, &ScreenArea); - if (XAAInit(pScreen, pATI->pXAAInfo)) - return TRUE; + if (XAAInit(pScreen, pATI->pXAAInfo)) + return TRUE; + } XAADestroyInfoRec(pATI->pXAAInfo); pATI->pXAAInfo = NULL; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c index 906e7e4ba..2954f40dd 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c,v 1.18 2001/03/25 05:32:07 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c,v 1.19 2001/04/25 18:21:10 tsi Exp $ */ /* * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -82,8 +82,11 @@ const char *ATIChipNames[] = "ATI Rage 128 Pro VR", "ATI Rage 128 Mobility M3", "ATI Rage 128 Mobility M4", + "ATI Rage 128 Ultra", "ATI unknown Rage 128" "ATI Radeon", + "ATI Radeon VE", + "ATI Radeon Mobility", "ATI Rage HDTV" }; @@ -531,6 +534,7 @@ ATIChipID case OldChipID('S', 'K'): case NewChipID('S', 'K'): case OldChipID('S', 'L'): case NewChipID('S', 'L'): case OldChipID('S', 'M'): case NewChipID('S', 'M'): + case OldChipID('S', 'N'): case NewChipID('S', 'N'): return ATI_CHIP_RAGE128GL; case OldChipID('R', 'K'): case NewChipID('R', 'K'): @@ -578,13 +582,28 @@ ATIChipID case OldChipID('M', 'L'): case NewChipID('M', 'L'): return ATI_CHIP_RAGE128MOBILITY4; + case OldChipID('T', 'F'): case NewChipID('T', 'F'): + case OldChipID('T', 'L'): case NewChipID('T', 'L'): + case OldChipID('T', 'R'): case NewChipID('T', 'R'): + case OldChipID('T', 'S'): case NewChipID('T', 'S'): + case OldChipID('T', 'T'): case NewChipID('T', 'T'): + case OldChipID('T', 'U'): case NewChipID('T', 'U'): + return ATI_CHIP_RAGE128ULTRA; + case OldChipID('Q', 'D'): case NewChipID('Q', 'D'): case OldChipID('Q', 'E'): case NewChipID('Q', 'E'): case OldChipID('Q', 'F'): case NewChipID('Q', 'F'): case OldChipID('Q', 'G'): case NewChipID('Q', 'G'): - case OldChipID('Q', 'Y'): case NewChipID('Q', 'Y'): return ATI_CHIP_RADEON; + case OldChipID('Q', 'Y'): case NewChipID('Q', 'Y'): + case OldChipID('Q', 'Z'): case NewChipID('Q', 'Z'): + return ATI_CHIP_RADEONVE; + + case OldChipID('L', 'Y'): case NewChipID('L', 'Y'): + case OldChipID('L', 'Z'): case NewChipID('L', 'Z'): + return ATI_CHIP_RADEONMOBILITY; + case OldChipID('H', 'D'): case NewChipID('H', 'D'): return ATI_CHIP_HDTV; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h index 17b0b1e25..160843aec 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h,v 1.14 2001/01/06 20:58:04 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h,v 1.15 2001/04/25 18:21:10 tsi Exp $ */ /* * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -84,8 +84,11 @@ typedef enum ATI_CHIP_RAGE128PROVR, /* Rage128 */ ATI_CHIP_RAGE128MOBILITY3, /* Rage128 */ ATI_CHIP_RAGE128MOBILITY4, /* Rage128 */ + ATI_CHIP_RAGE128ULTRA, /* Rage128 */ ATI_CHIP_Rage128, /* Rage128 */ ATI_CHIP_RADEON, /* Radeon */ + ATI_CHIP_RADEONVE, /* Radeon */ + ATI_CHIP_RADEONMOBILITY, /* Radeon */ ATI_CHIP_HDTV /* HDTV */ } ATIChipType; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c index e822d522c..fef2c0753 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c,v 1.30 2001/03/25 05:32:07 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c,v 1.35 2001/04/23 17:15:57 dawes Exp $ */ /* * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -1636,7 +1636,7 @@ ATIMach64SubsequentColorExpandScanline * This function fills in structure fields needed for acceleration on Mach64 * variants. */ -Bool +unsigned int ATIMach64AccelInit ( ATIPtr pATI, @@ -1684,6 +1684,9 @@ ATIMach64AccelInit */ pXAAInfo->ScanlineCPUToScreenColorExpandFillFlags = LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X | +#if X_BYTE_ORDER == X_BIG_ENDIAN + BIT_ORDER_IN_BYTE_MSBFIRST | +#endif CPU_TRANSFER_PAD_DWORD | SCANLINE_PAD_DWORD; if (pATI->XModifier != 1) pXAAInfo->ScanlineCPUToScreenColorExpandFillFlags |= TRIPLE_BITS_24BPP; @@ -1708,7 +1711,7 @@ ATIMach64AccelInit /* The engine does not support the following primitives for 24bpp */ if (pATI->XModifier != 1) - return TRUE; + return ATIMach64MaxY; /* Solid lines */ pXAAInfo->SetupForSolidLine = ATIMach64SetupForSolidLine; @@ -1716,7 +1719,7 @@ ATIMach64AccelInit pXAAInfo->SubsequentSolidBresenhamLine = ATIMach64SubsequentSolidBresenhamLine; - return TRUE; + return ATIMach64MaxY; } /* @@ -1824,6 +1827,13 @@ ATIMach64LoadCursorImage CARD32 *pSrc = (pointer)pImage; volatile CARD32 *pDst = pATI->pCursorImage; + /* Synchronise video memory accesses */ + if (pATI->OptionAccel && pATI->pXAAInfo->NeedToSync) + { + (*pATI->pXAAInfo->Sync)(pScreenInfo); + pATI->pXAAInfo->NeedToSync = FALSE; + } + /* This is lengthy, but it does maximise burst modes */ pDst[ 0] = pSrc[ 0]; pDst[ 1] = pSrc[ 1]; pDst[ 2] = pSrc[ 2]; pDst[ 3] = pSrc[ 3]; @@ -1972,7 +1982,7 @@ ATIMach64HideCursor return; pATI->NewHW.gen_test_cntl &= ~GEN_CUR_EN; - outr(GEN_TEST_CNTL, pATI->NewHW.gen_test_cntl); + out8(GEN_TEST_CNTL, GetByte(pATI->NewHW.gen_test_cntl, 0)); } /* @@ -1992,7 +2002,7 @@ ATIMach64ShowCursor return; pATI->NewHW.gen_test_cntl |= GEN_CUR_EN; - outr(GEN_TEST_CNTL, pATI->NewHW.gen_test_cntl); + out8(GEN_TEST_CNTL, GetByte(pATI->NewHW.gen_test_cntl, 0)); } /* @@ -2042,8 +2052,18 @@ ATIMach64CursorInit xf86CursorInfoPtr pCursorInfo ) { + /* + * For Mach64 variants, toggling hardware cursors on and off causes + * display artifacts. Ask the cursor support layers to always paint the + * cursor (whether or not it is entirely transparent) and to not hide the + * cursor when reloading its image. The three reasons behind turning off + * the hardware cursor that remain are when it moves to a different screen, + * on a switch to a software cursor or to a different virtual console. + */ pCursorInfo->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | HARDWARE_CURSOR_INVERT_MASK | + HARDWARE_CURSOR_SHOW_TRANSPARENT | + HARDWARE_CURSOR_UPDATE_UNHIDDEN | #if X_BYTE_ORDER != X_LITTLE_ENDIAN diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h index 52b5f3dbf..d2add73de 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h,v 1.11 2001/03/25 05:32:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h,v 1.12 2001/04/16 15:47:56 tsi Exp $ */ /* * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -33,18 +33,19 @@ #define ATIMach64MaxX 8191 #define ATIMach64MaxY 32767 -extern void ATIMach64PreInit FunctionPrototype((ScrnInfoPtr, ATIPtr, - ATIHWPtr)); -extern void ATIMach64Save FunctionPrototype((ATIPtr, ATIHWPtr)); -extern void ATIMach64Calculate FunctionPrototype((ATIPtr, ATIHWPtr, - DisplayModePtr)); -extern void ATIMach64Set FunctionPrototype((ATIPtr, ATIHWPtr)); +extern void ATIMach64PreInit FunctionPrototype((ScrnInfoPtr, + ATIPtr, ATIHWPtr)); +extern void ATIMach64Save FunctionPrototype((ATIPtr, ATIHWPtr)); +extern void ATIMach64Calculate FunctionPrototype((ATIPtr, ATIHWPtr, + DisplayModePtr)); +extern void ATIMach64Set FunctionPrototype((ATIPtr, ATIHWPtr)); -extern void ATIMach64SaveScreen FunctionPrototype((ATIPtr, int)); -extern void ATIMach64SetDPMSMode FunctionPrototype((ATIPtr, int)); +extern void ATIMach64SaveScreen FunctionPrototype((ATIPtr, int)); +extern void ATIMach64SetDPMSMode FunctionPrototype((ATIPtr, int)); -extern Bool ATIMach64AccelInit FunctionPrototype((ATIPtr, XAAInfoRecPtr)); +extern unsigned int ATIMach64AccelInit FunctionPrototype((ATIPtr, + XAAInfoRecPtr)); -extern Bool ATIMach64CursorInit FunctionPrototype((xf86CursorInfoPtr)); +extern Bool ATIMach64CursorInit FunctionPrototype((xf86CursorInfoPtr)); #endif /* ___ATIMACH64_H___ */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h index 502081653..e69709149 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.8 2001/03/25 05:32:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h,v 1.9 2001/04/16 15:02:09 tsi Exp $ */ /* * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -132,7 +132,7 @@ extern void ATIMach64PollEngineStatus FunctionPrototype((ATIPtr)); /* * MMIO cache definitions */ -#define CacheByte(___Register) pATI->MMIOCached[CacheSlotOf(___Register >> 3)] +#define CacheByte(___Register) pATI->MMIOCached[CacheSlotOf(___Register) >> 3] #define CacheBit(___Register) (0x80U >> (CacheSlotOf(___Register) & 0x07U)) #define RegisterIsCached(__Register) \ @@ -164,7 +164,7 @@ extern void ATIMach64PollEngineStatus FunctionPrototype((ATIPtr)); /* * This is no longer as critical, especially for _n == 1. However, - * there is still a need to ensure _n <= pATI-<nFIFOEntries. + * there is still a need to ensure _n <= pATI->nFIFOEntries. */ #define ATIMach64WaitForFIFO(_pATI, _n) \ while (pATI->nAvailableFIFOEntries < (_n)) \ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c index 2129b34fd..96b8e24b5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c,v 1.4 2001/03/25 05:32:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c,v 1.5 2001/04/16 15:02:09 tsi Exp $ */ /* * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -897,7 +897,9 @@ ATIModeSet outr(CUR_HORZ_VERT_OFF, pATIHW->cur_horz_vert_off); outr(MEM_VGA_WP_SEL, pATIHW->mem_vga_wp_sel); outr(MEM_VGA_RP_SEL, pATIHW->mem_vga_rp_sel); + outr(GEN_TEST_CNTL, pATIHW->gen_test_cntl | GEN_GUI_EN); outr(GEN_TEST_CNTL, pATIHW->gen_test_cntl); + outr(GEN_TEST_CNTL, pATIHW->gen_test_cntl | GEN_GUI_EN); outr(CONFIG_CNTL, pATIHW->config_cntl); if (pATI->Chip >= ATI_CHIP_264CT) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c index 91acd407d..09cf91b43 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c,v 1.19 2001/01/06 20:58:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c,v 1.20 2001/04/19 14:14:05 tsi Exp $ */ /* * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -647,6 +647,12 @@ ATIPrintRegisters else xf86ErrorFVerb(4, " No MMIO aperture.\n"); + if (pATI->pCursorImage) + xf86ErrorFVerb(4, " Hardware cursor image aperture at 0x%0lX.\n", + pATI->pCursorImage); + else + xf86ErrorFVerb(4, " No hardware cursor image aperture.\n"); + xf86ErrorFVerb(4, "\n"); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c index a7866b489..63a61a595 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v 1.42 2001/04/01 14:00:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v 1.44 2001/04/19 14:14:05 tsi Exp $ */ /* * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -24,7 +24,6 @@ #include "ati.h" #include "atiadapter.h" #include "atiadjust.h" -#include "atibios.h" #include "atibus.h" #include "atichip.h" #include "aticonsole.h" @@ -504,7 +503,8 @@ ATI8514Probe if (!(IOValue1 & (_8514_ONLY | CHIP_DIS))) { pATI->VGAAdapter = ATI_ADAPTER_MACH32; - if ((ATIReadBIOS(pATI, &pATI->CPIO_VGAWonder, 0x10U, + if ((xf86ReadBIOS(pATI->BIOSBase, 0x10U, + (pointer)(&pATI->CPIO_VGAWonder), SizeOf(pATI->CPIO_VGAWonder)) < SizeOf(pATI->CPIO_VGAWonder)) || !(pATI->CPIO_VGAWonder &= SPARSE_IO_PORT)) @@ -1155,15 +1155,15 @@ ATIProbe { for (i = 0; (pVideo = xf86PciVideoInfo[i++]); ) { - if (pVideo->vendor != PCI_VENDOR_ATI) - { - pPCI = pVideo->thisCard; + if (pVideo->vendor == PCI_VENDOR_ATI) + continue; - ATIScanPCIBases(&PCIPorts, &nPCIPort, - &pPCI->pci_base0, pVideo->size, - (pciReadLong(pPCI->tag, PCI_CMD_STAT_REG) & - PCI_CMD_IO_ENABLE) ? 0 : Allowed); - } + pPCI = pVideo->thisCard; + + ATIScanPCIBases(&PCIPorts, &nPCIPort, + &pPCI->pci_base0, pVideo->size, + (pciReadLong(pPCI->tag, PCI_CMD_STAT_REG) & + PCI_CMD_IO_ENABLE) ? 0 : Allowed); } } @@ -1172,16 +1172,16 @@ ATIProbe { for (i = 0; (pPCI = xf86PciInfo[i++]); ) { - if ((pPCI->pci_vendor != PCI_VENDOR_ATI) && - (pPCI->pci_base_class != PCI_CLASS_BRIDGE) && - !(pPCI->pci_header_type & + if ((pPCI->pci_vendor == PCI_VENDOR_ATI) || + (pPCI->pci_base_class == PCI_CLASS_BRIDGE) || + (pPCI->pci_header_type & ~GetByte(PCI_HEADER_MULTIFUNCTION, 2))) - { - ATIScanPCIBases(&PCIPorts, &nPCIPort, - &pPCI->pci_base0, pPCI->basesize, - (pciReadLong(pPCI->tag, PCI_CMD_STAT_REG) & - PCI_CMD_IO_ENABLE) ? 0 : Allowed); - } + continue; + + ATIScanPCIBases(&PCIPorts, &nPCIPort, + &pPCI->pci_base0, pPCI->basesize, + (pciReadLong(pPCI->tag, PCI_CMD_STAT_REG) & + PCI_CMD_IO_ENABLE) ? 0 : Allowed); } } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h index a64dc31f9..4bc4262a4 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h,v 1.16 2001/03/25 05:32:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h,v 1.17 2001/04/16 15:02:10 tsi Exp $ */ /* * Copyright 1994 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -55,7 +55,7 @@ #define IOPortTag(_SparseIOSelect, _BlockIOSelect) \ (SetBits(_SparseIOSelect, SPARSE_IO_SELECT) | \ - SetBits(_BlockIOSelect, BLOCK_SELECT | MM_IO_SELECT)) + SetBits(_BlockIOSelect, DWORD_SELECT)) #define SparseIOTag(_IOSelect) IOPortTag(_IOSelect, 0) #define BlockIOTag(_IOSelect) IOPortTag(0, _IOSelect) @@ -1098,7 +1098,7 @@ #define GEN_GIO2_WRITE 0x00000020ul /* 264xT */ #define GEN_CUR2_ENABLE 0x00000020ul /* XC/XL */ #define GEN_OVR_POLARITY 0x00000040ul /* GX/CX */ -#define GEN_GEN_ICON_ENABLE 0x00000040ul /* XC/XL */ +#define GEN_ICON_ENABLE 0x00000040ul /* XC/XL */ #define GEN_CUR_EN 0x00000080ul #define GEN_GUI_EN 0x00000100ul /* GX/CX */ #define GEN_GUI_RESETB 0x00000100ul /* 264xT */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h index 86036b8d2..dbed4e124 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h,v 1.33 2001/04/01 14:00:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h,v 1.36 2001/04/25 18:21:10 tsi Exp $ */ /* * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * @@ -27,11 +27,11 @@ #define ATI_NAME "ATI" #define ATI_DRIVER_NAME "ati" -#define ATI_VERSION_NAME "6.3.1" +#define ATI_VERSION_NAME "6.3.4" #define ATI_VERSION_MAJOR 6 #define ATI_VERSION_MINOR 3 -#define ATI_VERSION_PATCH 1 +#define ATI_VERSION_PATCH 4 #define ATI_VERSION_CURRENT \ ((ATI_VERSION_MAJOR << 20) | (ATI_VERSION_MINOR << 10) | ATI_VERSION_PATCH) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h index 003b9aa2e..f4d818fd0 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.10 2001/01/16 05:11:06 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.11 2001/04/10 16:07:58 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -273,6 +273,9 @@ typedef struct { drmHandle registerHandle; Bool IsPCI; /* Current card is a PCI card */ + drmSize pciSize; + drmHandle pciMemHandle; + unsigned char *PCI; /* Map */ drmSize agpSize; drmHandle agpMemHandle; /* Handle from drmAgpAlloc */ 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 ffb5fe0d2..b1ace42be 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.8 2001/03/03 22:26:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c,v 1.9 2001/04/10 16:07:58 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -838,9 +838,7 @@ static void R128SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) if (info->scanline_direct) return; --info->scanline_h; while (left) { -#if defined(__alpha__) - write_mem_barrier(); -#endif + write_mem_barrier(); if (left <= 8) { /* Last scanline - finish write to DATA_LAST */ if (info->scanline_h == 0) { @@ -982,9 +980,7 @@ static void R128SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) if (info->scanline_direct) return; --info->scanline_h; while (left) { -#if defined(__alpha__) - write_mem_barrier(); -#endif + write_mem_barrier(); if (left <= 8) { /* Last scanline - finish write to DATA_LAST */ if (info->scanline_h == 0) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c index 3127aff1d..e069d9100 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.12 2001/03/21 19:46:26 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.13 2001/04/10 16:07:59 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -47,12 +47,20 @@ /* X and server generic header files */ #include "xf86.h" #include "windowstr.h" +#include "xf86PciInfo.h" /* GLX/DRI/DRM definitions */ #define _XF86DRI_SERVER_ #include "GL/glxtokens.h" #include "sarea.h" +/* ?? HACK - for now, put this here... */ +/* ?? Alpha - this may need to be a variable to handle UP1x00 vs TITAN */ +#if defined(__alpha__) +# define DRM_PAGE_SIZE 8192 +#else +# define DRM_PAGE_SIZE 4096 +#endif /* Initialize the visual configs that are supported by the hardware. These are combined with the visual configs that the indirect @@ -72,6 +80,9 @@ static Bool R128InitVisualConfigs(ScreenPtr pScreen) case 8: /* 8bpp mode is not support */ case 15: /* FIXME */ case 24: /* FIXME */ + xf86DrvMsg(pScreen->myNum, X_WARNING, + "R128DRIScreenInit failed (depth %d not supported). " + "Disabling DRI.\n", info->CurrentLayout.pixel_code); return FALSE; #define R128_USE_ACCUM 1 @@ -83,18 +94,18 @@ static Bool R128InitVisualConfigs(ScreenPtr pScreen) if (R128_USE_STENCIL) numConfigs *= 2; if (!(pConfigs - = (__GLXvisualConfig*)xnfcalloc(sizeof(__GLXvisualConfig), + = (__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig), numConfigs))) { return FALSE; } if (!(pR128Configs - = (R128ConfigPrivPtr)xnfcalloc(sizeof(R128ConfigPrivRec), + = (R128ConfigPrivPtr)xcalloc(sizeof(R128ConfigPrivRec), numConfigs))) { xfree(pConfigs); return FALSE; } if (!(pR128ConfigPtrs - = (R128ConfigPrivPtr*)xnfcalloc(sizeof(R128ConfigPrivPtr), + = (R128ConfigPrivPtr*)xcalloc(sizeof(R128ConfigPrivPtr), numConfigs))) { xfree(pConfigs); xfree(pR128Configs); @@ -160,18 +171,18 @@ static Bool R128InitVisualConfigs(ScreenPtr pScreen) if (R128_USE_STENCIL) numConfigs *= 2; if (!(pConfigs - = (__GLXvisualConfig*)xnfcalloc(sizeof(__GLXvisualConfig), + = (__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig), numConfigs))) { return FALSE; } if (!(pR128Configs - = (R128ConfigPrivPtr)xnfcalloc(sizeof(R128ConfigPrivRec), + = (R128ConfigPrivPtr)xcalloc(sizeof(R128ConfigPrivRec), numConfigs))) { xfree(pConfigs); return FALSE; } if (!(pR128ConfigPtrs - = (R128ConfigPrivPtr*)xnfcalloc(sizeof(R128ConfigPrivPtr), + = (R128ConfigPrivPtr*)xcalloc(sizeof(R128ConfigPrivPtr), numConfigs))) { xfree(pConfigs); xfree(pR128Configs); @@ -399,12 +410,12 @@ static Bool R128DRIAgpInit(R128InfoPtr info, ScreenPtr pScreen) unsigned long mode; unsigned int vendor, device; int ret; - unsigned long cntl; + unsigned long cntl, chunk; int s, l; int flags; if (drmAgpAcquire(info->drmFD) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] AGP not available\n"); + xf86DrvMsg(pScreen->myNum, X_WARNING, "[agp] AGP not available\n"); return FALSE; } @@ -457,11 +468,11 @@ static Bool R128DRIAgpInit(R128InfoPtr info, ScreenPtr pScreen) /* Initialize the CCE ring buffer data */ info->ringStart = info->agpOffset; - info->ringMapSize = info->ringSize*1024*1024 + 4096; + info->ringMapSize = info->ringSize*1024*1024 + DRM_PAGE_SIZE; info->ringSizeLog2QW = R128MinBits(info->ringSize*1024*1024/8) - 1; info->ringReadOffset = info->ringStart + info->ringMapSize; - info->ringReadMapSize = 4096; + info->ringReadMapSize = DRM_PAGE_SIZE; /* Reserve space for vertex/indirect buffers */ info->bufStart = info->ringReadOffset + info->ringReadMapSize; @@ -576,21 +587,147 @@ static Bool R128DRIAgpInit(R128InfoPtr info, ScreenPtr pScreen) OUTREG(R128_AGP_BASE, info->ringHandle); /* Ring buf is at AGP offset 0 */ OUTREG(R128_AGP_CNTL, cntl); + /* Disable Rage 128's PCIGART registers */ + chunk = INREG(R128_BM_CHUNK_0_VAL); + chunk &= ~(R128_BM_PTR_FORCE_TO_PCI | + R128_BM_PM4_RD_FORCE_TO_PCI | + R128_BM_GLOBAL_FORCE_TO_PCI); + OUTREG(R128_BM_CHUNK_0_VAL, chunk); + + OUTREG(R128_PCI_GART_PAGE, 1); /* Ensure AGP GART is used (for now) */ + xf86EnablePciBusMaster(info->PciInfo, TRUE); return TRUE; } -#if 0 -/* Fake the vertex buffers for PCI cards. */ -static Bool R128DRIPciInit(R128InfoPtr info) +static Bool R128DRIPciInit(R128InfoPtr info, ScreenPtr pScreen) { - info->bufStart = 0; - info->bufMapSize = info->bufSize*1024*1024; + unsigned char *R128MMIO = info->MMIO; + CARD32 chunk; + int ret; + int flags; + + info->agpOffset = 0; + + ret = drmScatterGatherAlloc(info->drmFD, info->agpSize*1024*1024, + &info->pciMemHandle); + if (ret < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[pci] Out of memory (%d)\n", ret); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] %d kB allocated with handle 0x%08x\n", + info->agpSize*1024, info->pciMemHandle); + + /* Initialize the CCE ring buffer data */ + info->ringStart = info->agpOffset; + info->ringMapSize = info->ringSize*1024*1024 + DRM_PAGE_SIZE; + info->ringSizeLog2QW = R128MinBits(info->ringSize*1024*1024/8) - 1; + + info->ringReadOffset = info->ringStart + info->ringMapSize; + info->ringReadMapSize = DRM_PAGE_SIZE; + + /* Reserve space for vertex/indirect buffers */ + info->bufStart = info->ringReadOffset + info->ringReadMapSize; + info->bufMapSize = info->bufSize*1024*1024; + + flags = DRM_READ_ONLY | DRM_LOCKED | DRM_KERNEL; + + if (drmAddMap(info->drmFD, info->ringStart, info->ringMapSize, + DRM_SCATTER_GATHER, flags, &info->ringHandle) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[pci] Could not add ring mapping\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] ring handle = 0x%08lx\n", info->ringHandle); + + if (drmMap(info->drmFD, info->ringHandle, info->ringMapSize, + (drmAddressPtr)&info->ring) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[pci] Could not map ring\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] Ring mapped at 0x%08lx\n", + (unsigned long)info->ring); + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] Ring contents 0x%08lx\n", + *(unsigned long *)info->ring); + + if (drmAddMap(info->drmFD, info->ringReadOffset, info->ringReadMapSize, + DRM_SCATTER_GATHER, flags, &info->ringReadPtrHandle) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[pci] Could not add ring read ptr mapping\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] ring read ptr handle = 0x%08lx\n", + info->ringReadPtrHandle); + + if (drmMap(info->drmFD, info->ringReadPtrHandle, info->ringReadMapSize, + (drmAddressPtr)&info->ringReadPtr) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[pci] Could not map ring read ptr\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] Ring read ptr mapped at 0x%08lx\n", + (unsigned long)info->ringReadPtr); + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] Ring read ptr contents 0x%08lx\n", + *(unsigned long *)info->ringReadPtr); + + if (drmAddMap(info->drmFD, info->bufStart, info->bufMapSize, + DRM_SCATTER_GATHER, 0, &info->bufHandle) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[pci] Could not add vertex/indirect buffers mapping\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] vertex/indirect buffers handle = 0x%08lx\n", + info->bufHandle); + + if (drmMap(info->drmFD, info->bufHandle, info->bufMapSize, + (drmAddressPtr)&info->buf) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[pci] Could not map vertex/indirect buffers\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] Vertex/indirect buffers mapped at 0x%08lx\n", + (unsigned long)info->buf); + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] Vertex/indirect buffers contents 0x%08lx\n", + *(unsigned long *)info->buf); + + switch (info->Chipset) { + case PCI_CHIP_RAGE128LE: + case PCI_CHIP_RAGE128RE: + case PCI_CHIP_RAGE128RK: + /* This is a PCI card, do nothing */ + break; + + case PCI_CHIP_RAGE128LF: + case PCI_CHIP_RAGE128MF: + case PCI_CHIP_RAGE128ML: + case PCI_CHIP_RAGE128RF: + case PCI_CHIP_RAGE128RG: + case PCI_CHIP_RAGE128RL: + case PCI_CHIP_RAGE128PF: + default: + /* This is really an AGP card, force PCI GART mode */ + chunk = INREG(R128_BM_CHUNK_0_VAL); + chunk |= (R128_BM_PTR_FORCE_TO_PCI | + R128_BM_PM4_RD_FORCE_TO_PCI | + R128_BM_GLOBAL_FORCE_TO_PCI); + OUTREG(R128_BM_CHUNK_0_VAL, chunk); + OUTREG(R128_PCI_GART_PAGE, 0); /* Ensure PCI GART is used */ + break; + } return TRUE; } -#endif /* Add a map for the MMIO registers that will be accessed by any DRI-based clients. */ @@ -655,11 +792,20 @@ static int R128DRIKernelInit(R128InfoPtr info, ScreenPtr pScreen) static Bool R128DRIBufInit(R128InfoPtr info, ScreenPtr pScreen) { /* Initialize vertex buffers */ - if ((info->bufNumBufs = drmAddBufs(info->drmFD, - info->bufMapSize / R128_BUFFER_SIZE, - R128_BUFFER_SIZE, - DRM_AGP_BUFFER, - info->bufStart)) <= 0) { + if (info->IsPCI) { + info->bufNumBufs = drmAddBufs(info->drmFD, + info->bufMapSize / R128_BUFFER_SIZE, + R128_BUFFER_SIZE, + DRM_SG_BUFFER, + info->bufStart); + } else { + info->bufNumBufs = drmAddBufs(info->drmFD, + info->bufMapSize / R128_BUFFER_SIZE, + R128_BUFFER_SIZE, + DRM_AGP_BUFFER, + info->bufStart); + } + if (info->bufNumBufs <= 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] Could not create vertex/indirect buffers list\n"); return FALSE; @@ -803,7 +949,7 @@ Bool R128DRIScreenInit(ScreenPtr pScreen) pDRIInfo->SAREASize = SAREA_MAX; #endif - if (!(pR128DRI = (R128DRIPtr)xnfcalloc(sizeof(R128DRIRec),1))) { + if (!(pR128DRI = (R128DRIPtr)xcalloc(sizeof(R128DRIRec),1))) { DRIDestroyInfoRec(info->pDRIInfo); info->pDRIInfo = NULL; return FALSE; @@ -853,22 +999,18 @@ Bool R128DRIScreenInit(ScreenPtr pScreen) /* Initialize AGP */ if (!info->IsPCI && !R128DRIAgpInit(info, pScreen)) { - R128DRICloseScreen(pScreen); - return FALSE; + info->IsPCI = TRUE; + xf86DrvMsg(pScreen->myNum, X_WARNING, + "AGP failed to initialize -- falling back to PCI mode.\n"); + xf86DrvMsg(pScreen->myNum, X_WARNING, + "Make sure you have the agpgart kernel module loaded.\n"); } -#if 0 - /* Initialize PCI */ + + /* Initialize PCIGART */ if (info->IsPCI && !R128DRIPciInit(info, pScreen)) { R128DRICloseScreen(pScreen); return FALSE; } -#else - if (info->IsPCI) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "PCI cards not yet supported\n"); - R128DRICloseScreen(pScreen); - return FALSE; - } -#endif /* DRIScreenInit doesn't add all the common mappings. Add additional @@ -918,7 +1060,7 @@ Bool R128DRIFinishScreenInit(ScreenPtr pScreen) } /* Initialize the vertex buffers list */ - if (!info->IsPCI && !R128DRIBufInit(info, pScreen)) { + if (!R128DRIBufInit(info, pScreen)) { R128DRICloseScreen(pScreen); return FALSE; } @@ -929,36 +1071,36 @@ Bool R128DRIFinishScreenInit(ScreenPtr pScreen) pSAREAPriv = (R128SAREAPrivPtr)DRIGetSAREAPrivate(pScreen); memset(pSAREAPriv, 0, sizeof(*pSAREAPriv)); - pR128DRI = (R128DRIPtr)info->pDRIInfo->devPrivate; - - pR128DRI->deviceID = info->Chipset; - pR128DRI->width = pScrn->virtualX; - pR128DRI->height = pScrn->virtualY; - pR128DRI->depth = pScrn->depth; - pR128DRI->bpp = pScrn->bitsPerPixel; - - pR128DRI->IsPCI = info->IsPCI; - pR128DRI->AGPMode = info->agpMode; - - pR128DRI->frontOffset = info->frontOffset; - pR128DRI->frontPitch = info->frontPitch; - pR128DRI->backOffset = info->backOffset; - pR128DRI->backPitch = info->backPitch; - pR128DRI->depthOffset = info->depthOffset; - pR128DRI->depthPitch = info->depthPitch; - pR128DRI->spanOffset = info->spanOffset; - pR128DRI->textureOffset = info->textureOffset; - pR128DRI->textureSize = info->textureSize; - pR128DRI->log2TexGran = info->log2TexGran; - - pR128DRI->registerHandle = info->registerHandle; - pR128DRI->registerSize = info->registerSize; - - pR128DRI->agpTexHandle = info->agpTexHandle; - pR128DRI->agpTexMapSize = info->agpTexMapSize; - pR128DRI->log2AGPTexGran = info->log2AGPTexGran; - pR128DRI->agpTexOffset = info->agpTexStart; - pR128DRI->sarea_priv_offset = sizeof(XF86DRISAREARec); + pR128DRI = (R128DRIPtr)info->pDRIInfo->devPrivate; + + pR128DRI->deviceID = info->Chipset; + pR128DRI->width = pScrn->virtualX; + pR128DRI->height = pScrn->virtualY; + pR128DRI->depth = pScrn->depth; + pR128DRI->bpp = pScrn->bitsPerPixel; + + pR128DRI->IsPCI = info->IsPCI; + pR128DRI->AGPMode = info->agpMode; + + pR128DRI->frontOffset = info->frontOffset; + pR128DRI->frontPitch = info->frontPitch; + pR128DRI->backOffset = info->backOffset; + pR128DRI->backPitch = info->backPitch; + pR128DRI->depthOffset = info->depthOffset; + pR128DRI->depthPitch = info->depthPitch; + pR128DRI->spanOffset = info->spanOffset; + pR128DRI->textureOffset = info->textureOffset; + pR128DRI->textureSize = info->textureSize; + pR128DRI->log2TexGran = info->log2TexGran; + + pR128DRI->registerHandle = info->registerHandle; + pR128DRI->registerSize = info->registerSize; + + pR128DRI->agpTexHandle = info->agpTexHandle; + pR128DRI->agpTexMapSize = info->agpTexMapSize; + pR128DRI->log2AGPTexGran = info->log2AGPTexGran; + pR128DRI->agpTexOffset = info->agpTexStart; + pR128DRI->sarea_priv_offset = sizeof(XF86DRISAREARec); return TRUE; } @@ -1007,6 +1149,10 @@ void R128DRICloseScreen(ScreenPtr pScreen) info->agpMemHandle = 0; drmAgpRelease(info->drmFD); } + if (info->pciMemHandle) { + drmScatterGatherFree(info->drmFD, info->pciMemHandle); + info->pciMemHandle = 0; + } /* De-allocate all DRI resources */ DRICloseScreen(pScreen); 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 0dae469be..5f3f1cbf3 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.25 2001/04/03 17:10:36 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v 1.26 2001/04/10 16:07:59 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -626,7 +626,7 @@ static Bool R128GetPLLParameters(ScrnInfoPtr pScrn) R128InfoPtr info = R128PTR(pScrn); R128PLLPtr pll = &info->pll; -#if defined(__powerpc__) +#if defined(__powerpc__) || defined(__alpha__) /* there is no bios under Linux PowerPC but Open Firmware does set up the PLL registers properly and we can use those to calculate xclk and find the reference divider */ @@ -1186,9 +1186,7 @@ static Bool R128PreInitDRI(ScrnInfoPtr pScrn) { R128InfoPtr info = R128PTR(pScrn); - if (info->IsPCI) { - info->CCEMode = R128_DEFAULT_CCE_PIO_MODE; - } else if (xf86ReturnOptValBool(R128Options, OPTION_CCE_PIO, FALSE)) { + if (xf86ReturnOptValBool(R128Options, OPTION_CCE_PIO, FALSE)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Forcing CCE into PIO mode\n"); info->CCEMode = R128_DEFAULT_CCE_PIO_MODE; } else { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h index b2620ae0a..e1dba03e9 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.10 2001/03/03 22:26:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.11 2001/04/10 16:07:59 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -191,6 +191,10 @@ #define R128_BIOS_7_SCRATCH 0x002c #define R128_BIOS_ROM 0x0f30 /* PCI */ #define R128_BIST 0x0f0f /* PCI */ +#define R128_BM_CHUNK_0_VAL 0x0a18 +# define R128_BM_PTR_FORCE_TO_PCI (1 << 21) +# define R128_BM_PM4_RD_FORCE_TO_PCI (1 << 22) +# define R128_BM_GLOBAL_FORCE_TO_PCI (1 << 23) #define R128_BRUSH_DATA0 0x1480 #define R128_BRUSH_DATA1 0x1484 #define R128_BRUSH_DATA10 0x14a8 diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h index c1b50ace9..4a51516f4 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.16 2001/03/25 05:32:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.18 2001/04/16 15:02:11 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -279,6 +279,9 @@ typedef struct { drmHandle registerHandle; Bool IsPCI; /* Current card is a PCI card */ + drmSize pciSize; + drmHandle pciMemHandle; + unsigned char *PCI; /* Map */ Bool depthMoves; /* Enable depth moves -- slow! */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c index 407757ef8..9ce6221a8 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c,v 1.10 2001/04/01 14:00:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c,v 1.12 2001/04/16 15:02:11 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, * VA Linux Systems Inc., Fremont, California. @@ -52,6 +52,13 @@ #include "GL/glxtokens.h" #include "sarea.h" +/* ?? HACK - for now, put this here... */ +/* ?? Alpha - this may need to be a variable to handle UP1x00 vs TITAN */ +#if defined(__alpha__) +# define DRM_PAGE_SIZE 8192 +#else +# define DRM_PAGE_SIZE 4096 +#endif /* Initialize the visual configs that are supported by the hardware. These are combined with the visual configs that the indirect @@ -82,18 +89,18 @@ static Bool RADEONInitVisualConfigs(ScreenPtr pScreen) if (RADEON_USE_STENCIL) numConfigs *= 2; if (!(pConfigs - = (__GLXvisualConfig*)xnfcalloc(sizeof(__GLXvisualConfig), + = (__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig), numConfigs))) { return FALSE; } if (!(pRADEONConfigs - = (RADEONConfigPrivPtr)xnfcalloc(sizeof(RADEONConfigPrivRec), + = (RADEONConfigPrivPtr)xcalloc(sizeof(RADEONConfigPrivRec), numConfigs))) { xfree(pConfigs); return FALSE; } if (!(pRADEONConfigPtrs - = (RADEONConfigPrivPtr*)xnfcalloc(sizeof(RADEONConfigPrivPtr), + = (RADEONConfigPrivPtr*)xcalloc(sizeof(RADEONConfigPrivPtr), numConfigs))) { xfree(pConfigs); xfree(pRADEONConfigs); @@ -158,18 +165,18 @@ static Bool RADEONInitVisualConfigs(ScreenPtr pScreen) if (RADEON_USE_STENCIL) numConfigs *= 2; if (!(pConfigs - = (__GLXvisualConfig*)xnfcalloc(sizeof(__GLXvisualConfig), + = (__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig), numConfigs))) { return FALSE; } if (!(pRADEONConfigs - = (RADEONConfigPrivPtr)xnfcalloc(sizeof(RADEONConfigPrivRec), + = (RADEONConfigPrivPtr)xcalloc(sizeof(RADEONConfigPrivRec), numConfigs))) { xfree(pConfigs); return FALSE; } if (!(pRADEONConfigPtrs - = (RADEONConfigPrivPtr*)xnfcalloc(sizeof(RADEONConfigPrivPtr), + = (RADEONConfigPrivPtr*)xcalloc(sizeof(RADEONConfigPrivPtr), numConfigs))) { xfree(pConfigs); xfree(pRADEONConfigs); @@ -753,11 +760,11 @@ static Bool RADEONDRIAgpInit(RADEONInfoPtr info, ScreenPtr pScreen) /* Initialize the CP ring buffer data */ info->ringStart = info->agpOffset; - info->ringMapSize = info->ringSize*1024*1024 + 4096; + info->ringMapSize = info->ringSize*1024*1024 + DRM_PAGE_SIZE; info->ringSizeLog2QW = RADEONMinBits(info->ringSize*1024*1024/8)-1; info->ringReadOffset = info->ringStart + info->ringMapSize; - info->ringReadMapSize = 4096; + info->ringReadMapSize = DRM_PAGE_SIZE; /* Reserve space for vertex/indirect buffers */ info->bufStart = info->ringReadOffset + info->ringReadMapSize; @@ -861,11 +868,105 @@ static Bool RADEONDRIAgpInit(RADEONInfoPtr info, ScreenPtr pScreen) } #if 0 -/* Fake the vertex buffers for PCI cards. */ +/* Initialize the PCIGART state. Request memory for use in PCI space, + and initialize the Radeon registers to point to that memory. */ static Bool RADEONDRIPciInit(RADEONInfoPtr info, ScreenPtr pScreen) { - info->bufStart = 0; - info->bufMapSize = info->bufSize*1024*1024; + int ret; + int flags; + + info->agpOffset = 0; + + ret = drmScatterGatherAlloc(info->drmFD, info->agpSize*1024*1024, + &info->pciMemHandle); + if (ret < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[pci] Out of memory (%d)\n", ret); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] %d kB allocated with handle 0x%08x\n", + info->agpSize*1024, info->pciMemHandle); + + /* Initialize the CCE ring buffer data */ + info->ringStart = info->agpOffset; + info->ringMapSize = info->ringSize*1024*1024 + DRM_PAGE_SIZE; + info->ringSizeLog2QW = RADEONMinBits(info->ringSize*1024*1024/8)-1; + + info->ringReadOffset = info->ringStart + info->ringMapSize; + info->ringReadMapSize = DRM_PAGE_SIZE; + + /* Reserve space for vertex/indirect buffers */ + info->bufStart = info->ringReadOffset + info->ringReadMapSize; + info->bufMapSize = info->bufSize*1024*1024; + + flags = DRM_READ_ONLY | DRM_LOCKED | DRM_KERNEL; + + if (drmAddMap(info->drmFD, info->ringStart, info->ringMapSize, + DRM_SCATTER_GATHER, flags, &info->ringHandle) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[pci] Could not add ring mapping\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] ring handle = 0x%08lx\n", info->ringHandle); + + if (drmMap(info->drmFD, info->ringHandle, info->ringMapSize, + (drmAddressPtr)&info->ring) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[pci] Could not map ring\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] Ring mapped at 0x%08lx\n", + (unsigned long)info->ring); + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] Ring contents 0x%08lx\n", + *(unsigned long *)info->ring); + + if (drmAddMap(info->drmFD, info->ringReadOffset, info->ringReadMapSize, + DRM_SCATTER_GATHER, flags, &info->ringReadPtrHandle) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[pci] Could not add ring read ptr mapping\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] ring read ptr handle = 0x%08lx\n", + info->ringReadPtrHandle); + + if (drmMap(info->drmFD, info->ringReadPtrHandle, info->ringReadMapSize, + (drmAddressPtr)&info->ringReadPtr) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[pci] Could not map ring read ptr\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] Ring read ptr mapped at 0x%08lx\n", + (unsigned long)info->ringReadPtr); + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] Ring read ptr contents 0x%08lx\n", + *(unsigned long *)info->ringReadPtr); + + if (drmAddMap(info->drmFD, info->bufStart, info->bufMapSize, + DRM_SCATTER_GATHER, 0, &info->bufHandle) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[pci] Could not add vertex/indirect buffers mapping\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] vertex/indirect buffers handle = 0x%08lx\n", + info->bufHandle); + + if (drmMap(info->drmFD, info->bufHandle, info->bufMapSize, + (drmAddressPtr)&info->buf) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[pci] Could not map vertex/indirect buffers\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] Vertex/indirect buffers mapped at 0x%08lx\n", + (unsigned long)info->buf); + xf86DrvMsg(pScreen->myNum, X_INFO, + "[pci] Vertex/indirect buffers contents 0x%08lx\n", + *(unsigned long *)info->buf); return TRUE; } @@ -933,11 +1034,24 @@ static int RADEONDRIKernelInit(RADEONInfoPtr info, ScreenPtr pScreen) static Bool RADEONDRIBufInit(RADEONInfoPtr info, ScreenPtr pScreen) { /* Initialize vertex buffers */ - if ((info->bufNumBufs = drmAddBufs(info->drmFD, - info->bufMapSize / RADEON_BUFFER_SIZE, - RADEON_BUFFER_SIZE, - DRM_AGP_BUFFER, - info->bufStart)) <= 0) { + if (info->IsPCI) { +#if 1 + return TRUE; +#else + info->bufNumBufs = drmAddBufs(info->drmFD, + info->bufMapSize / RADEON_BUFFER_SIZE, + RADEON_BUFFER_SIZE, + DRM_SG_BUFFER, + info->bufStart); +#endif + } else { + info->bufNumBufs = drmAddBufs(info->drmFD, + info->bufMapSize / RADEON_BUFFER_SIZE, + RADEON_BUFFER_SIZE, + DRM_AGP_BUFFER, + info->bufStart); + } + if (info->bufNumBufs <= 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] Could not create vertex/indirect buffers list\n"); return FALSE; @@ -1255,7 +1369,7 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen) pDRIInfo->SAREASize = SAREA_MAX; #endif - if (!(pRADEONDRI = (RADEONDRIPtr)xnfcalloc(sizeof(RADEONDRIRec),1))) { + if (!(pRADEONDRI = (RADEONDRIPtr)xcalloc(sizeof(RADEONDRIRec),1))) { DRIDestroyInfoRec(info->pDRIInfo); info->pDRIInfo = NULL; return FALSE; @@ -1287,11 +1401,11 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen) version = drmGetVersion(info->drmFD); if (version) { if (version->version_major != 1 || - version->version_minor < 0) { + version->version_minor < 1) { /* incompatible drm version */ xf86DrvMsg(pScreen->myNum, X_ERROR, "RADEONDRIScreenInit failed " - "(DRM version = %d.%d.%d, expected 1.0.x). " + "(DRM version = %d.%d.%d, expected 1.1.x). " "Disabling DRI.\n", version->version_major, version->version_minor, @@ -1303,20 +1417,31 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen) drmFreeVersion(version); } +#if 1 /* Initialize AGP */ if (!info->IsPCI && !RADEONDRIAgpInit(info, pScreen)) { RADEONDRICloseScreen(pScreen); return FALSE; } -#if 0 + /* Initialize PCI */ - if (info->IsPCI && !RADEONDRIPciInit(info, pScreen)) { + if (info->IsPCI) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "PCI cards not yet supported\n"); RADEONDRICloseScreen(pScreen); return FALSE; } #else - if (info->IsPCI) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "PCI cards not yet supported\n"); + /* Initialize AGP */ + if (!info->IsPCI && !RADEONDRIAgpInit(info, pScreen)) { + info->IsPCI = TRUE; + xf86DrvMsg(pScreen->myNum, X_WARNING, + "AGP failed to initialize -- falling back to PCI mode.\n"); + xf86DrvMsg(pScreen->myNum, X_WARNING, + "Make sure you have the agpgart kernel module loaded.\n"); + } + + /* Initialize PCI */ + if (info->IsPCI && !RADEONDRIPciInit(info, pScreen)) { RADEONDRICloseScreen(pScreen); return FALSE; } @@ -1370,7 +1495,7 @@ Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen) } /* Initialize the vertex buffers list */ - if (!info->IsPCI && !RADEONDRIBufInit(info, pScreen)) { + if (!RADEONDRIBufInit(info, pScreen)) { RADEONDRICloseScreen(pScreen); return FALSE; } @@ -1384,39 +1509,39 @@ Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen) RADEONDRISAREAInit(pScreen, pSAREAPriv); - pRADEONDRI = (RADEONDRIPtr)info->pDRIInfo->devPrivate; + pRADEONDRI = (RADEONDRIPtr)info->pDRIInfo->devPrivate; - pRADEONDRI->deviceID = info->Chipset; - pRADEONDRI->width = pScrn->virtualX; - pRADEONDRI->height = pScrn->virtualY; - pRADEONDRI->depth = pScrn->depth; - pRADEONDRI->bpp = pScrn->bitsPerPixel; + pRADEONDRI->deviceID = info->Chipset; + pRADEONDRI->width = pScrn->virtualX; + pRADEONDRI->height = pScrn->virtualY; + pRADEONDRI->depth = pScrn->depth; + pRADEONDRI->bpp = pScrn->bitsPerPixel; - pRADEONDRI->IsPCI = info->IsPCI; - pRADEONDRI->AGPMode = info->agpMode; + pRADEONDRI->IsPCI = info->IsPCI; + pRADEONDRI->AGPMode = info->agpMode; - pRADEONDRI->frontOffset = info->frontOffset; - pRADEONDRI->frontPitch = info->frontPitch; - pRADEONDRI->backOffset = info->backOffset; - pRADEONDRI->backPitch = info->backPitch; - pRADEONDRI->depthOffset = info->depthOffset; - pRADEONDRI->depthPitch = info->depthPitch; - pRADEONDRI->textureOffset = info->textureOffset; - pRADEONDRI->textureSize = info->textureSize; - pRADEONDRI->log2TexGran = info->log2TexGran; + pRADEONDRI->frontOffset = info->frontOffset; + pRADEONDRI->frontPitch = info->frontPitch; + pRADEONDRI->backOffset = info->backOffset; + pRADEONDRI->backPitch = info->backPitch; + pRADEONDRI->depthOffset = info->depthOffset; + pRADEONDRI->depthPitch = info->depthPitch; + pRADEONDRI->textureOffset = info->textureOffset; + pRADEONDRI->textureSize = info->textureSize; + pRADEONDRI->log2TexGran = info->log2TexGran; - pRADEONDRI->registerHandle = info->registerHandle; - pRADEONDRI->registerSize = info->registerSize; + pRADEONDRI->registerHandle = info->registerHandle; + pRADEONDRI->registerSize = info->registerSize; - pRADEONDRI->statusHandle = info->ringReadPtrHandle; - pRADEONDRI->statusSize = info->ringReadMapSize; + pRADEONDRI->statusHandle = info->ringReadPtrHandle; + pRADEONDRI->statusSize = info->ringReadMapSize; - pRADEONDRI->agpTexHandle = info->agpTexHandle; - pRADEONDRI->agpTexMapSize = info->agpTexMapSize; - pRADEONDRI->log2AGPTexGran = info->log2AGPTexGran; - pRADEONDRI->agpTexOffset = info->agpTexStart; + pRADEONDRI->agpTexHandle = info->agpTexHandle; + pRADEONDRI->agpTexMapSize = info->agpTexMapSize; + pRADEONDRI->log2AGPTexGran = info->log2AGPTexGran; + pRADEONDRI->agpTexOffset = info->agpTexStart; - pRADEONDRI->sarea_priv_offset = sizeof(XF86DRISAREARec); + pRADEONDRI->sarea_priv_offset = sizeof(XF86DRISAREARec); #ifdef PER_CONTEXT_SAREA /* Set per-context SAREA size */ @@ -1470,6 +1595,10 @@ void RADEONDRICloseScreen(ScreenPtr pScreen) info->agpMemHandle = 0; drmAgpRelease(info->drmFD); } + if (info->pciMemHandle) { + drmScatterGatherFree(info->drmFD, info->pciMemHandle); + info->pciMemHandle = 0; + } /* De-allocate all DRI resources */ DRICloseScreen(pScreen); 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 0c2180602..400495fb2 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.18 2001/04/03 17:10:36 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.21 2001/04/27 14:40:13 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -501,11 +501,6 @@ static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) int FPHeader = 0; #endif -#define RADEONReadBIOS(offset, buffer, length) \ - (info->BIOSFromPCI ? \ - xf86ReadPciBIOS(offset, info->PciTag, 0, buffer, length) : \ - xf86ReadBIOS(info->BIOSAddr, offset, buffer, length)) - #define RADEON_BIOS8(v) (info->VBIOS[v]) #define RADEON_BIOS16(v) (info->VBIOS[v] | \ (info->VBIOS[(v) + 1] << 8)) @@ -1103,9 +1098,7 @@ static Bool RADEONPreInitDRI(ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR(pScrn); - if (info->IsPCI) { - info->CPMode = RADEON_DEFAULT_CP_PIO_MODE; - } else if (xf86ReturnOptValBool(RADEONOptions, OPTION_CP_PIO, FALSE)) { + if (xf86ReturnOptValBool(RADEONOptions, OPTION_CP_PIO, FALSE)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Forcing CP into PIO mode\n"); info->CPMode = RADEON_DEFAULT_CP_PIO_MODE; } else { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 b/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 index 5285b59ae..c8950a4bc 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 @@ -1,15 +1,14 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.8 2001/02/24 14:29:16 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.9 2001/04/18 09:24:47 alanh Exp $ */ -STATUS as of Mon, 16 Oct 2000 21:24:51 +0200 +STATUS as of Fri, 13 Apr 2001 21:43:39 +0200 Working : * Unaccelerated : Depth 8, 15, 16 and 24 are ok. I tested them upto 1280x1024 only as my monitor don't support higher modes. * Endianess clean, thanks to Romain Dolbeau <dolbeaur@club-internet.fr> for helping me debug this. - * HW cursor : - - The cursor cannot be hidden, we need to move it offscreen instead. - * ShadowFb works. + * HW cursor. + * ShadowFb. * Full 2D Accels. - Sync. - Pixmap cache. @@ -25,7 +24,10 @@ Working : - Pixmap Writes using direct FIFO writes with or without FIFO Disconnect. * Appian J2000 second head initialization. * Dual head : The console fonts will get trashed, but dual head works. - * Xv : Is working, but there are still problems when using smaller displays. + * Xv : Hardware video scaler with the following attributes : + - FILTER : None, Partial (X only) or Full filtering. + - OVERLAY_MODE : Opaque, Blended or Color keyed Video Overlay. + - MIRROR : X and/or Y Axis mirroring. * DRI : Work is underway. Not Working : @@ -37,13 +39,20 @@ Not Working : - Render extension initialization. - CPUToScreenTexture. - CPUToScreenAlphaTexture. + * [NEED FIX] Xv has still some minor problems : + - Currently it needs accel to work. + => we could enable the offscreen memory manager, but this will crash the + server. I guess this is because of bad timing. + - Crashes when used with the gamma chip. + - Clipping is not supported. + => we could use framebuffer alpha blending or alpha channel keyed video + overlay to simulate it, but this would need to set the framebuffer alpha + channel as a mask, and would be very inefficient. Maybe we could use a + second framebuffer to do this, and use it as a mask ? * [WORK IS UNDERWAY] DRI/OpenGL (only together with a gamma chip) : - DRI support should be ok, but accelerated openGL is not yet supported. - The accelerated OpenGL library supposes we are using a gamma together with a MX rasterizer, not a Permedia3 one. - -Known Problem : - * 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 @@ -53,13 +62,13 @@ Known Problem : 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. - * R-B inversion. Sometimes, all of a sudden, it seems as the + * [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. - * When moving a window around a lot quicly, the video outputs dies. + * [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. * Sometimes there are blue transparent garbage in the form of small horizontal bands, few pixels high, and more pixels width, maybe 64pixels ? - This seems like a hardware bug. + This may be a hardware bug. Sven Luther <luther@dpt-info.u-strasbg.fr> diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h index 5f190632d..2baed5658 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.46 2001/03/19 22:50:28 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h,v 1.47 2001/04/18 09:24:47 alanh Exp $ */ /* * Copyright 1997-2001 by Alan Hourihane <alanh@fairlite.demon.co.uk> * @@ -235,6 +235,7 @@ void Permedia3Save(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); Bool Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg); Bool Permedia3AccelInit(ScreenPtr pScreen); void Permedia3InitializeEngine(ScrnInfoPtr pScrn); +void Permedia3EnableOffscreen(ScreenPtr pScreen); void Permedia3Sync(ScrnInfoPtr pScrn); void DualPermedia3Sync(ScrnInfoPtr pScrn); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c index a82d7da8a..0b6587185 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c @@ -21,7 +21,7 @@ * * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c,v 1.2 2001/01/31 16:14:54 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c,v 1.3 2001/04/10 20:33:30 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -42,8 +42,10 @@ static int GLINT_GetViewport(ScrnInfoPtr); static void GLINT_SetViewport(ScrnInfoPtr, int, int, int); static void GLINT_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); static void GLINT_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); +#if 0 static void GLINT_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, unsigned long); +#endif static DGAFunctionRec GLINTDGAFuncs = { @@ -259,6 +261,7 @@ GLINT_BlitRect( } +#if 0 static void GLINT_BlitTransRect( ScrnInfoPtr pScrn, @@ -270,6 +273,7 @@ GLINT_BlitTransRect( /* this one should be separate since the XAA function would prohibit usage of ~0 as the key */ } +#endif static Bool diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c index 2272403c1..c02847088 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c,v 1.25 2001/03/28 11:10:56 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c,v 1.26 2001/04/10 16:08:00 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -92,20 +92,20 @@ GLINTInitVisualConfigs(ScreenPtr pScreen) either alpha buffer or 3D rendering in Overlay */ numConfigs = 5; - if (!(pConfigs = (__GLXvisualConfig *)xnfcalloc( + if (!(pConfigs = (__GLXvisualConfig *)xcalloc( sizeof(__GLXvisualConfig), numConfigs))) { return FALSE; } - if (!(pGlintConfigs = (GLINTConfigPrivPtr)xnfcalloc( + if (!(pGlintConfigs = (GLINTConfigPrivPtr)xcalloc( sizeof(GLINTConfigPrivRec), numConfigs))) { xfree(pConfigs); return FALSE; } - if (!(pGlintConfigPtrs = (GLINTConfigPrivPtr *)xnfcalloc( + if (!(pGlintConfigPtrs = (GLINTConfigPrivPtr *)xcalloc( sizeof(GLINTConfigPrivPtr), numConfigs))) { xfree(pGlintConfigs); @@ -412,7 +412,7 @@ GLINTDRIScreenInit(ScreenPtr pScreen) pDRIInfo->SAREASize = SAREA_MAX; #endif - if (!(pGlintDRI = (GLINTDRIPtr)xnfcalloc(sizeof(GLINTDRIRec),1))) { + if (!(pGlintDRI = (GLINTDRIPtr)xcalloc(sizeof(GLINTDRIRec),1))) { DRIDestroyInfoRec(pGlint->pDRIInfo); return FALSE; } 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 e362f31d7..fe03f47b1 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.120 2001/03/19 22:50:28 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.122 2001/04/19 09:28:32 alanh Exp $ */ #include "fb.h" #include "cfb8_32.h" @@ -574,14 +574,13 @@ GLINTIdentify(int flags) xf86PrintChipsets(GLINT_NAME, "driver for 3Dlabs chipsets", GLINTChipsets); } -static -OptionInfoPtr +static OptionInfoPtr GLINTAvailableOptions(int chipid, int busid) { return GLINTOptions; } -void +static void GLINTProbeDDC(ScrnInfoPtr pScrn, int index) { vbeInfoPtr pVbe; @@ -1030,8 +1029,14 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) } if (flags & PROBE_DETECT) { - GLINTProbeDDC(pScrn, pGlint->pEnt->index); - return TRUE; + EntityInfoPtr pEnt = xf86GetEntityInfo(pScrn->entityList[0]); + pciVideoPtr pPci = xf86GetPciInfoForEntity(pEnt->index); + + if (!(pPci->chipType == PCI_CHIP_GAMMA)) { + GLINTProbeDDC(pScrn, pGlint->pEnt->index); + return TRUE; + } else + return FALSE; } xf86SetOperatingState(resVgaMemShared, pGlint->pEnt->index, ResDisableOpr); @@ -3223,7 +3228,9 @@ GLINTCloseScreen(int scrnIndex, ScreenPtr pScreen) static void GLINTFreeScreen(int scrnIndex, int flags) { +#if DEBUG ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; +#endif TRACE_ENTER("GLINTFreeScreen"); if (xf86LoaderCheckSymbol("fbdevHWFreeRec")) fbdevHWFreeRec(xf86Screens[scrnIndex]); 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 06e1cb265..a684b81b6 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.25 2001/02/15 11:03:57 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h,v 1.26 2001/04/19 09:28:32 alanh Exp $ */ /* * glint register file @@ -32,6 +32,9 @@ #define PCI_CHIP_TI_PERMEDIA 0x3d04 /* The boards we know */ +#define IS_GLORIAXXL ((pGlint->PciInfo->subsysVendor == 0x1048) && \ + (pGlint->PciInfo->subsysCard == 0x0a42)) + #define IS_GMX2000 ((pGlint->PciInfo->subsysVendor == 0x3d3d) && \ (pGlint->PciInfo->subsysCard == 0x0106)) 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 4cf9a4a31..2a8b55891 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.23 2001/02/27 23:04:59 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c,v 1.25 2001/04/18 09:24:47 alanh Exp $ */ #include "Xarch.h" #include "xf86.h" @@ -58,9 +58,6 @@ # define TRACE(str) #endif -/* Sync */ -void Permedia3Sync(ScrnInfoPtr pScrn); -void DualPermedia3Sync(ScrnInfoPtr pScrn); /* Clipping */ static void Permedia3SetClippingRectangle(ScrnInfoPtr pScrn, int x, int y, int w, int h); @@ -364,7 +361,6 @@ Permedia3AccelInit(ScreenPtr pScreen) XAAInfoRecPtr infoPtr; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; GLINTPtr pGlint = GLINTPTR(pScrn); - BoxRec AvailFBArea; pGlint->AccelInfoRec = infoPtr = XAACreateInfoRec(); if (!infoPtr) return FALSE; @@ -452,18 +448,6 @@ Permedia3AccelInit(ScreenPtr pScreen) infoPtr->WritePixmap = Permedia3WritePixmap; infoPtr->WritePixmapFlags = 0; - /* Available Framebuffer Area for XAA. */ - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - /* X coords are short's so we have to do this to make sure we dont wrap*/ - AvailFBArea.y2 = ((pGlint->FbMapSize > 16384*1024) ? 16384*1024 : - pGlint->FbMapSize) / (pScrn->displayWidth * - pScrn->bitsPerPixel / 8); - - /* Permedia3 has a maximum 4096x4096 framebuffer */ - if (AvailFBArea.y2 > 4095) AvailFBArea.y2 = 4095; - { Bool shared_accel = FALSE; int i; @@ -476,11 +460,33 @@ Permedia3AccelInit(ScreenPtr pScreen) infoPtr->RestoreAccelState = Permedia3RestoreAccelState; } - xf86InitFBManager(pScreen, &AvailFBArea); + Permedia3EnableOffscreen(pScreen); return(XAAInit(pScreen, infoPtr)); } +void +Permedia3EnableOffscreen (ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + GLINTPtr pGlint = GLINTPTR(pScrn); + BoxRec AvailFBArea; + + if (xf86FBManagerRunning(pScreen)) return; + /* Available Framebuffer Area for XAA. */ + AvailFBArea.x1 = 0; + AvailFBArea.y1 = 0; + AvailFBArea.x2 = pScrn->displayWidth; + /* X coords are short's so we have to do this to make sure we dont wrap*/ + AvailFBArea.y2 = ((pGlint->FbMapSize > 16384*1024) ? 16384*1024 : + pGlint->FbMapSize) / (pScrn->displayWidth * + pScrn->bitsPerPixel / 8); + + /* Permedia3 has a maximum 4096x4096 framebuffer */ + if (AvailFBArea.y2 > 4095) AvailFBArea.y2 = 4095; + + xf86InitFBManager(pScreen, &AvailFBArea); +} #define CHECKCLIPPING \ { \ if (pGlint->ClippingOn) { \ 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 0b6685177..a09ca3508 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.5 2001/02/24 14:29:18 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h,v 1.6 2001/04/18 09:24:48 alanh Exp $ */ /* * glint register file @@ -189,6 +189,7 @@ #define PM3VideoOverlayMode_COLORORDER_RGB (1<<12) #define PM3VideoOverlayMode_LINEARCOLOREXT_OFF (0<<13) #define PM3VideoOverlayMode_LINEARCOLOREXT_ON (1<<13) + #define PM3VideoOverlayMode_FILTER_MASK (3<<14) #define PM3VideoOverlayMode_FILTER_OFF (0<<14) #define PM3VideoOverlayMode_FILTER_FULL (1<<14) #define PM3VideoOverlayMode_FILTER_PARTIAL (2<<14) @@ -199,12 +200,14 @@ #define PM3VideoOverlayMode_FLIP_VIDEO (0<<20) #define PM3VideoOverlayMode_FLIP_VIDEOSTREAMA (1<<20) #define PM3VideoOverlayMode_FLIP_VIDEOSTREAMB (2<<20) + #define PM3VideoOverlayMode_MIRROR_MASK (3<<23) #define PM3VideoOverlayMode_MIRRORX_OFF (0<<23) #define PM3VideoOverlayMode_MIRRORX_ON (1<<23) #define PM3VideoOverlayMode_MIRRORY_OFF (0<<24) #define PM3VideoOverlayMode_MIRRORY_ON (1<<24) #define PM3VideoOverlayFifoControl 0x3110 #define PM3VideoOverlayIndex 0x3118 +#define PM3VideoOverlayBase 0x3120 #define PM3VideoOverlayBase0 0x3120 #define PM3VideoOverlayBase1 0x3128 #define PM3VideoOverlayBase2 0x3130 @@ -372,6 +375,7 @@ #define PM3RD_VideoOverlayControl 0x020 #define PM3RD_VideoOverlayControl_DISABLE (0<<0) #define PM3RD_VideoOverlayControl_ENABLE (1<<0) + #define PM3RD_VideoOverlayControl_MODE_MASK (3<<1) #define PM3RD_VideoOverlayControl_MODE_MAINKEY (0<<1) #define PM3RD_VideoOverlayControl_MODE_OVERLAYKEY (1<<1) #define PM3RD_VideoOverlayControl_MODE_ALWAYS (2<<1) 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 400442b8b..78c0fcad6 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c @@ -23,7 +23,7 @@ * Based on work of Michael H. Schimek <m.schimek@netway.at> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c,v 1.1 2001/02/24 14:29:19 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c,v 1.3 2001/04/18 09:24:49 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -39,6 +39,8 @@ #include "pm3_regs.h" #include "glint.h" +#define DEBUG(x) + #ifndef XvExtension void Permedia3VideoInit(ScreenPtr pScreen) {} @@ -58,98 +60,96 @@ void Permedia3VideoLeaveVT(ScrnInfoPtr pScrn) {} #define CLAMP(v, min, max) (((v) < (min)) ? (min) : MIN(v, max)) #define ENTRIES(array) (sizeof(array) / sizeof((array)[0])) -#define ADAPTORS 1 -#define PORTS 1 - #define MAX_BUFFERS 3 -typedef struct { - CARD32 xy, wh; /* 16.0 16.0 */ - INT32 s, t; /* 12.20 fp */ - short y1, y2; -} CookieRec, *CookiePtr; +enum { + OVERLAY_DATA_NONE, + OVERLAY_DATA_COLORKEY, + OVERLAY_DATA_ALPHAKEY, + OVERLAY_DATA_ALPHABLEND +} ; typedef struct _PortPrivRec { struct _AdaptorPrivRec * pAdaptor; - INT32 Attribute[8]; /* Brig, Con, Sat, Hue, Int, Filt, BkgCol, Alpha */ - - int BuffersRequested; - int BuffersAllocated; - FBAreaPtr pFBArea[MAX_BUFFERS]; - CARD32 BufferBase[MAX_BUFFERS]; /* FB byte offset */ - int CurrentBuffer; + /* Attributes */ + char OverlayData; + INT32 OverlayMode; + INT32 OverlayControl; + INT32 Attribute[3]; + + /* Buffers */ + int Id, Bpp; + int Format, Bpp_shift; + short display, copy; + FBLinearPtr Buffer[MAX_BUFFERS]; CARD32 BufferStride; /* bytes */ + int OverlayStride; /* pixels */ + /* Buffer and Drawable size and position */ INT32 vx, vy, vw, vh; /* 12.10 fp */ int dx, dy, dw, dh; - int fw, fh; - - int Id, Bpp; /* Scaler */ - int Plug; - int BkgCol; /* RGB 5:6:5; 5:6:5 */ - int StopDelay; - + /* Timer stuff */ + OsTimerPtr Timer; + Bool TimerInUse; + int Delay, Instant, StopDelay; } PortPrivRec, *PortPrivPtr; -enum { VIDEO_OFF, VIDEO_ONE_SHOT, VIDEO_ON }; - -typedef struct _LFBAreaRec { - struct _LFBAreaRec * Next; - int Linear; - FBAreaPtr pFBArea; -} LFBAreaRec, *LFBAreaPtr; - typedef struct _AdaptorPrivRec { struct _AdaptorPrivRec * Next; ScrnInfoPtr pScrn; - - OsTimerPtr Timer; - int TimerUsers; - int Delay, Instant; - - int FramesPerSec; - int FrameLines; - int IntLine; /* Frame, not field */ - int LinePer; /* nsec */ - - int VideoStd; - - PortPrivRec Port[PORTS]; - + PortPrivPtr pPort; } AdaptorPrivRec, *AdaptorPrivPtr; -static AdaptorPrivPtr AdaptorPrivList = NULL; - -#define PORTNUM(p) ((int)((p) - &pAPriv->Port[0])) +static AdaptorPrivPtr AdaptorPriv; -#define DEBUG(x) x - -static const Bool ColorBars = FALSE; /* - * Attributes + * Proprietary Attributes */ -#define XV_ENCODING "XV_ENCODING" -#define XV_BRIGHTNESS "XV_BRIGHTNESS" -#define XV_CONTRAST "XV_CONTRAST" -#define XV_SATURATION "XV_SATURATION" -#define XV_HUE "XV_HUE" +#define XV_FILTER "XV_FILTER" +/* We support 3 sorts of filters : + * 0 : None. + * 1 : Partial (only in the X directrion). + * 2 : Full. + */ -/* Proprietary */ +#define XV_MIRROR "XV_MIRROR" +/* We also support mirroring of the image : + * bit 0 : if set, will mirror in the X direction. + * bit 1 : if set, will mirror in the Y direction. + */ + +#define XV_OVERLAY_MODE "XV_OVERLAY_MODE" +/* We support these different overlay modes (bit 0-2) : + * 0 : Opaque video overlay (default). + * 1 : Color keyed overlay, framebuffer color key. + * Data : bit 3-27 : color key in RGB 888 format. + * 2 : Color keyed overlay, framebuffer alpha key. + * Data : bit 3-11 : 8 bit alpha key. + * 3 : Color keyed overlay, overlay color key. + * Data : bit 3-27 : color key in RGB 888 format. + * 4 : Per pixel alpha blending. + * 5 : Constant alpha blending. + * Data : bit 3-11 : 8 bit alpha blend factor. + * 6-7 : Reserved. + */ -#define XV_INTERLACE "XV_INTERLACE" /* Interlaced (bool) */ -#define XV_FILTER "XV_FILTER" /* Bilinear filter (bool) */ -#define XV_BKGCOLOR "XV_BKGCOLOR" /* Output background (0x00RRGGBB) */ -#define XV_ALPHA "XV_ALPHA" /* Scaler alpha channel (bool) */ + +static XF86AttributeRec +ScalerAttributes[] = +{ + { XvSettable | XvGettable, 0, 2, XV_FILTER }, + { XvSettable | XvGettable, 0, 3, XV_MIRROR }, + { XvSettable | XvGettable, 0, (2<<27)-1, XV_OVERLAY_MODE }, +}; #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) -static Atom xvEncoding, xvBrightness, xvContrast, xvSaturation, xvHue; -static Atom xvInterlace, xvFilter, xvBkgColor, xvAlpha; +static Atom xvFilter, xvMirror, xvOverlayMode; /* Scaler */ @@ -160,13 +160,6 @@ ScalerEncodings[] = { 0, "XV_IMAGE", 2047, 2047, { 1, 1 }}, }; -static XF86AttributeRec -ScalerAttributes[] = -{ - { XvSettable | XvGettable, 0, 1, XV_FILTER }, - { XvSettable | XvGettable, 0, 1, XV_ALPHA }, -}; - static XF86VideoFormatRec ScalerVideoFormats[] = { @@ -263,173 +256,114 @@ ScalerImages[] = 8, XvPacked, 1, 8, 0xC0, 0x38, 0x07, 0, 0, 0, 0, 0, 0, 0, 0, 0, "BGR", XvTopToBottom }, }; - /* * Buffer management */ static void -RemoveAreaCallback(FBAreaPtr pFBArea) +RemoveAreaCallback(FBLinearPtr Buffer) { - PortPrivPtr pPPriv = (PortPrivPtr) pFBArea->devPrivate.ptr; - AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; - DEBUG(ScrnInfoPtr pScrn = pAPriv->pScrn;) - int i; - - /* Well, for each buffer, just do nothing ? */ - for (i = 0; i < MAX_BUFFERS && pPPriv->pFBArea[i] != pFBArea; i++); - - if (i >= MAX_BUFFERS) - return; - - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, - "RemoveAreaCallback port #%d, buffer #%d, pFB=%p, off=0x%08x\n", - PORTNUM(pPPriv), i, pPPriv->pFBArea[i], pPPriv->BufferBase[i])); - - for (; i < MAX_BUFFERS - 1; i++) - pPPriv->pFBArea[i] = pPPriv->pFBArea[i + 1]; - - pPPriv->pFBArea[MAX_BUFFERS - 1] = NULL; - - pPPriv->BuffersAllocated--; + PortPrivPtr pPPriv = (PortPrivPtr) Buffer->devPrivate.ptr; + int i = -1; + + /* 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; } static void -RemoveableBuffers(PortPrivPtr pPPriv, Bool remove) +FreeBuffers(PortPrivPtr pPPriv, Bool from_timer) { - int i; + int i = -1; - for (i = 0; i < MAX_BUFFERS; i++) - if (pPPriv->pFBArea[i]) - pPPriv->pFBArea[i]->RemoveAreaCallback = - remove ? RemoveAreaCallback : NULL; + if (!from_timer) { + if (pPPriv->TimerInUse) { + pPPriv->TimerInUse = FALSE; + TimerCancel(pPPriv->Timer); + } + } + + for (i=0; i < MAX_BUFFERS; i++) + if (pPPriv->Buffer[i]) { + xf86FreeOffscreenLinear (pPPriv->Buffer[i]); + pPPriv->Buffer[i] = NULL; + } } -static void -FreeBuffers(PortPrivPtr pPPriv) +static CARD32 +TimerCallback(OsTimerPtr pTim, CARD32 now, pointer p) { - DEBUG(AdaptorPrivPtr pAPriv = pPPriv->pAdaptor;) - DEBUG(ScrnInfoPtr pScrn = pAPriv->pScrn;) - int i; + PortPrivPtr pPPriv = (PortPrivPtr) p; - RemoveableBuffers(pPPriv, FALSE); - - for (i = MAX_BUFFERS - 1; i >= 0; i--) - if (pPPriv->pFBArea[i]) { - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "FreeBuffers port #%d, buffer #%d, pFB=%p, off=0x%08x\n", - PORTNUM(pPPriv), i, pPPriv->pFBArea[i], pPPriv->BufferBase[i])); - - xf86FreeOffscreenArea(pPPriv->pFBArea[i]); - - pPPriv->pFBArea[i] = NULL; + if (pPPriv->StopDelay >= 0) { + if (!(pPPriv->StopDelay--)) { + FreeBuffers(pPPriv, TRUE); + pPPriv->TimerInUse = FALSE; } + } - pPPriv->BuffersAllocated = 0; -} + if (pPPriv->TimerInUse) + return pPPriv->Instant; -enum { FORCE_LINEAR = 1, FORCE_RECT }; + return 0; /* Cancel */ +} static int AllocateBuffers(PortPrivPtr pPPriv, - int w, int h, int bytespp, - int num, int force) + int w_bpp, int h) { AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; ScrnInfoPtr pScrn = pAPriv->pScrn; - GLINTPtr pGlint = GLINTPTR(pScrn); - Bool linear = (force != FORCE_RECT); - int i; - if (!linear) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Sorry, only linear buffers allowed right now ...\n"); - return 0; + int i = -1; + + /* 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); } - FreeBuffers(pPPriv); - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "SVEN : Tryig ot allocate (%d) %s buffer with : %dx%d, bpp = %d.\n", - num, (force==FORCE_RECT)?"rectangular":"linear", w, h, bytespp)); - for (i = 0; i < num; i++) { - if (linear) { - pPPriv->BufferStride = w * bytespp; - - /* Well, we need to set alignement correctly ... */ -#if 0 - pPPriv->pFBArea[i] = xf86AllocateLinearOffscreenArea(pScrn->pScreen, - (pPPriv->BufferStride * h - + (1 << pGlint->BppShift) -1) >> pGlint->BppShift, - 16 >> pGlint->BppShift, NULL, NULL, (pointer) pPPriv); -#endif - pPPriv->pFBArea[i] = xf86AllocateLinearOffscreenArea(pScrn->pScreen, - pPPriv->BufferStride * h, 0, NULL, NULL, (pointer) pPPriv); - /* Well, not that we have allocated a buffer, let's see - * to what it correspond in the cards memory space ... */ - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "SVEN : Let's see what kind of buffer got allocated ...\n" - "\t BOX : x1 = %d, y1 = %d, x2 = %d, y2 = %d.\n" - "\t pScrn->virtualX = %d, pGlint->BppShift = %d.\n", - pPPriv->pFBArea[i]->box.x1, pPPriv->pFBArea[i]->box.y1, - pPPriv->pFBArea[i]->box.x2, pPPriv->pFBArea[i]->box.y2, - pScrn->virtualX, pGlint->BppShift)); - - if (pPPriv->pFBArea[i]) - pPPriv->BufferBase[i] = - ((pPPriv->pFBArea[i]->box.y1 * pScrn->virtualX) + - pPPriv->pFBArea[i]->box.x1) << pGlint->BppShift; - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "New linear buffer %dx%d, rec %dx%d -> pFB=%p, off=0x%08x\n" - "\tNotice : Framebuffer is at : 0x%08x, 0x%08x.\n", - w, h, pPPriv->BufferStride, h, pPPriv->pFBArea[i], - pPPriv->BufferBase[i], pGlint->FbAddress, pGlint->FbBase)); - } else { -#if 0 - /* SVEN : well for now, all buffers are linear, so we don't need - * to worry. */ - pPPriv->BufferStride = pScrn->displayWidth << BPPSHIFT(pGlint); - pPPriv->pFBArea[i] = xf86AllocateOffscreenArea(pScrn->pScreen, - w, h, 8 >> BPPSHIFT(pGlint), NULL, NULL, (pointer) pPPriv); - if (pPPriv->pFBArea[i]) - pPPriv->BufferBase[i] = - ((pPPriv->pFBArea[i]->box.y1 * pScrn->displayWidth) + - pPPriv->pFBArea[i]->box.x1) << BPPSHIFT(pGlint); + for (i=0; i < MAX_BUFFERS && (i == pPPriv->display || i == pPPriv->copy); i++); + + if (pPPriv->Buffer[i]) { + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "Buffer %d exists.\n", i)); + if (pPPriv->Buffer[i]->size == w_bpp * h) { DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, - "New rect buffer %dx%d, stride %d, pFB=%p, off=0x%08x\n", - w, h, pPPriv->BufferStride, pPPriv->pFBArea[i], - pPPriv->BufferBase[i])); -#endif + "Buffer %d is of the good size, let's use it.\n", i)); + return (pPPriv->copy = i); } - if (pPPriv->pFBArea[i]) - continue; - } - - return pPPriv->BuffersAllocated = i; - return pPPriv->CurrentBuffer = 0; -} - -/* os/WaitFor.c */ - -static CARD32 -TimerCallback(OsTimerPtr pTim, CARD32 now, pointer p) -{ - AdaptorPrivPtr pAPriv = (AdaptorPrivPtr) p; - int i; - - for (i = 0; i <= PORTS; i++) { - if (pAPriv->Port[i].StopDelay >= 0) { - if (!(pAPriv->Port[i].StopDelay--)) { - FreeBuffers(&pAPriv->Port[i]); - pAPriv->TimerUsers &= ~(1 << i); + else if (xf86ResizeOffscreenLinear (pPPriv->Buffer[i], w_bpp * h)) { + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "I was able to resize buffer %d, let's use it.\n", i)); + return (pPPriv->copy = i); + } + else { + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "I was not able to resize buffer %d.\n", i)); + xf86FreeOffscreenLinear (pPPriv->Buffer[i]); + pPPriv->Buffer[i] = NULL; } - } } - - if (pAPriv->TimerUsers) - return pAPriv->Instant; - - return 0; /* Cancel */ + if ((pPPriv->Buffer[i] = xf86AllocateOffscreenLinear (pScrn->pScreen, + w_bpp * h, 0, NULL, NULL, (pointer) pPPriv))) { + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "Sucessfully allocated buffer %d, let's use it.\n", i)); + return (pPPriv->copy = i); + } + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "Unable to allocate a buffer.\n")); + return -1; } +#define GET_OFFSET(pScrn, offset) \ + (offset + (pScrn->virtualY*pScrn->displayWidth*pScrn->bitsPerPixel/8)) + /* * Xv interface */ @@ -542,7 +476,7 @@ compute_scale_factor( } else { if (*src_w & 0x3) *src_w = (*src_w & ~0x3) + 4; *shrink_delta = 1<<16; - for (;*dst_w > *src_w; *dst_w--) { + 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; @@ -553,29 +487,74 @@ compute_scale_factor( } } -/* BeginOverlay ... - * This is still not workign correctly, in particular if we are - * using shrinking, since what we have to check is not a multiple of 4 - * width is the shrinked width, not the original width. - */ +/* Some thougth about clipping : + * + * To support clipping, we will need to : + * - We need to convert the clipregion to a bounding box + * and a bitmap that is the mask associated with the clipregion. + * - Load this bitmap to offscreen memory. + * - Copy/expand this bitmap to the needed area, masking only the alpha + * channel of the framebuffer. + * - Use either the alpha blended or framebuffer alpha keyed overlay mode to + * mask the clipped away region. + * - If the clip region gets changed, we have to upload a new clip mask, + * clear the old alpha mask in the framebuffer and copy the new clip mask + * to the framebuffer again. + * - If the position of the region get's changed (but not the clip mask) we + * need to clear the old frambuffer clip mask in the alpha channel and + * upload the new one. + * + * All this will only work if : + * + * 1) we are using an framebuffer format with an alpha channel, that is + * RGBA 8888 (depth 24) and RGBA 5551 (depth 15). + * 2) nobody else uses the alpha channel. + * + */ + static void -BeginOverlay(PortPrivPtr pPPriv, CARD32* BufferBase, int num, - int format, int bpp_shift, int alpha) +BeginOverlay(PortPrivPtr pPPriv, int display, int bpp_shift, BoxPtr extent) { AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; ScrnInfoPtr pScrn = pAPriv->pScrn; GLINTPtr pGlint = GLINTPTR(pScrn); - unsigned int src_w = pPPriv->vw; - unsigned int dst_w = pPPriv->dw; + unsigned int 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; + /* Let's overlay only to visible parts of the screen + * Note : this has no place here, and will not work if + * clipping is not supported, since Xv will not show this. */ + 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 (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; + } + /* Let's adjust the width of source and dest to be compliant with * the Permedia3 overlay unit requirement, and compute the X deltas. */ compute_scale_factor(&src_w, &dst_w, &shrink_delta, &zoom_delta); - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "BeginOverlay %08x %08x %d %d\n", - BufferBase[0], format, bpp_shift, alpha)); + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "BeginOverlay\n")); if (src_w != pPPriv->vw) DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "BeginOverlay : Padding video width to 4 pixels %d->%d.\n", @@ -585,51 +564,42 @@ BeginOverlay(PortPrivPtr pPPriv, CARD32* BufferBase, int num, "BeginOverlay : Scaling destination width from %d to %d.\n" "\tThe scaling factor is to high, and may cause problems.", pPPriv->dw, dst_w)); - if (alpha) - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0, - "BeginOverlay Sorry, Alpha is not yet supported, disabling it.\n")); + if (display != -1) pPPriv->display = display; GLINT_WAIT(12); GLINT_WRITE_REG(3|(12<<16), PM3VideoOverlayFifoControl); /* Updating the Video Overlay Source Image Parameters */ - switch (num) { - case 0: - GLINT_WRITE_REG((BufferBase[0]>>bpp_shift), PM3VideoOverlayBase0); - break; - case 1: - GLINT_WRITE_REG((BufferBase[1]>>bpp_shift), PM3VideoOverlayBase1); - break; - case 2: - GLINT_WRITE_REG((BufferBase[2]>>bpp_shift), PM3VideoOverlayBase2); - break; - } - GLINT_WRITE_REG(num, PM3VideoOverlayIndex); - GLINT_WRITE_REG(format | + GLINT_WRITE_REG( + GET_OFFSET(pScrn, pPPriv->Buffer[pPPriv->display]->offset)>>bpp_shift, + PM3VideoOverlayBase+(pPPriv->display*8)); + GLINT_WRITE_REG(pPPriv->display, PM3VideoOverlayIndex); + GLINT_WRITE_REG(pPPriv->Format | PM3VideoOverlayMode_BUFFERSYNC_MANUAL | PM3VideoOverlayMode_FLIP_VIDEO | - PM3VideoOverlayMode_FILTER_FULL | + /* Filtering & Mirroring Attributes */ + pPPriv->OverlayMode | PM3VideoOverlayMode_ENABLE, PM3VideoOverlayMode); /* Let's set the source stride. */ - GLINT_WRITE_REG(PM3VideoOverlayStride_STRIDE(pPPriv->fw), + GLINT_WRITE_REG(PM3VideoOverlayStride_STRIDE(pPPriv->OverlayStride), PM3VideoOverlayStride); /* Let's set the position and size of the visible part of the source. */ GLINT_WRITE_REG(PM3VideoOverlayWidth_WIDTH(src_w), PM3VideoOverlayWidth); - GLINT_WRITE_REG(PM3VideoOverlayHeight_HEIGHT(pPPriv->vh), + GLINT_WRITE_REG(PM3VideoOverlayHeight_HEIGHT(src_h), PM3VideoOverlayHeight); GLINT_WRITE_REG( - PM3VideoOverlayOrigin_XORIGIN(pPPriv->vx) | - PM3VideoOverlayOrigin_YORIGIN(pPPriv->vy), + PM3VideoOverlayOrigin_XORIGIN(src_x) | + PM3VideoOverlayOrigin_YORIGIN(src_y), PM3VideoOverlayOrigin); /* Scale the source to the destinationsize */ - if (pPPriv->vh == pPPriv->dh) { + if (src_h == dst_h) { GLINT_WRITE_REG( PM3VideoOverlayYDelta_NONE, PM3VideoOverlayYDelta); } else { GLINT_WRITE_REG( - PM3VideoOverlayYDelta_DELTA(pPPriv->vh,pPPriv->dh), + PM3VideoOverlayYDelta_DELTA(src_h,dst_h), PM3VideoOverlayYDelta); } GLINT_WRITE_REG(shrink_delta, PM3VideoOverlayShrinkXDelta); @@ -639,27 +609,47 @@ BeginOverlay(PortPrivPtr pPPriv, CARD32* BufferBase, int num, PM3VideoOverlayUpdate); /* Setting the ramdac video overlay rgion */ /* Begining of overlay region */ - RAMDAC_WRITE((pPPriv->dx&0xff), PM3RD_VideoOverlayXStartLow); - RAMDAC_WRITE((pPPriv->dx&0xf00)>>8, PM3RD_VideoOverlayXStartHigh); - RAMDAC_WRITE((pPPriv->dy&0xff), PM3RD_VideoOverlayYStartLow); - RAMDAC_WRITE((pPPriv->dy&0xf00)>>8, PM3RD_VideoOverlayYStartHigh); + RAMDAC_WRITE((dst_x&0xff), PM3RD_VideoOverlayXStartLow); + RAMDAC_WRITE((dst_x&0xf00)>>8, PM3RD_VideoOverlayXStartHigh); + RAMDAC_WRITE((dst_y&0xff), PM3RD_VideoOverlayYStartLow); + RAMDAC_WRITE((dst_y&0xf00)>>8, PM3RD_VideoOverlayYStartHigh); /* End of overlay regions (+1) */ - RAMDAC_WRITE(((pPPriv->dx+dst_w)&0xff), PM3RD_VideoOverlayXEndLow); - RAMDAC_WRITE(((pPPriv->dx+dst_w)&0xf00)>>8,PM3RD_VideoOverlayXEndHigh); - RAMDAC_WRITE(((pPPriv->dy+pPPriv->dh)&0xff), PM3RD_VideoOverlayYEndLow); - RAMDAC_WRITE(((pPPriv->dy+pPPriv->dh)&0xf00)>>8,PM3RD_VideoOverlayYEndHigh); + RAMDAC_WRITE(((dst_x+dst_w)&0xff), PM3RD_VideoOverlayXEndLow); + RAMDAC_WRITE(((dst_x+dst_w)&0xf00)>>8,PM3RD_VideoOverlayXEndHigh); + RAMDAC_WRITE(((dst_y+dst_h)&0xff), PM3RD_VideoOverlayYEndLow); + RAMDAC_WRITE(((dst_y+dst_h)&0xf00)>>8,PM3RD_VideoOverlayYEndHigh); + switch (pPPriv->OverlayData) { + case OVERLAY_DATA_COLORKEY : + RAMDAC_WRITE(((pPPriv->OverlayControl>>8)&0xff), + PM3RD_VideoOverlayKeyR); + RAMDAC_WRITE(((pPPriv->OverlayControl>>16)&0xff), + PM3RD_VideoOverlayKeyG); + RAMDAC_WRITE(((pPPriv->OverlayControl>>24)&0xff), + PM3RD_VideoOverlayKeyB); + break; + case OVERLAY_DATA_ALPHAKEY : + RAMDAC_WRITE(((pPPriv->OverlayControl>>8)&0xff), + PM3RD_VideoOverlayKeyR); + break; + case OVERLAY_DATA_ALPHABLEND : + RAMDAC_WRITE(((pPPriv->OverlayControl>>8)&0xff), + PM3RD_VideoOverlayBlend); + break; + } /* And now enable Video Overlay in the RAMDAC */ RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | - PM3RD_VideoOverlayControl_MODE_ALWAYS, + /* OverlayMode attribute */ + (pPPriv->OverlayControl&0xff), PM3RD_VideoOverlayControl); - /* Let's use a double buffering scheme */ - pPPriv->CurrentBuffer = 1-pPPriv->CurrentBuffer; + pPPriv->Buffer[pPPriv->display]->RemoveLinearCallback = + RemoveAreaCallback; + if (display != -1) pPPriv->copy = -1; } static void -StopOverlay(PortPrivPtr pPPriv, CARD32* BufferBase, int num, int cleanup) +StopOverlay(PortPrivPtr pPPriv, int cleanup) { AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; ScrnInfoPtr pScrn = pAPriv->pScrn; @@ -674,6 +664,55 @@ StopOverlay(PortPrivPtr pPPriv, CARD32* BufferBase, int num, int cleanup) GLINT_WRITE_REG(PM3VideoOverlayMode_DISABLE, PM3VideoOverlayMode); } +/* ReputImage may be used if only the position of the destination changes, + * maybe while moving the window around or something such. + */ +static int +Permedia3ReputImage(ScrnInfoPtr pScrn, + short drw_x, short drw_y, + RegionPtr clipBoxes, pointer data) +{ + PortPrivPtr pPPriv = (PortPrivPtr) data; + GLINTPtr pGlint = GLINTPTR(pScrn); + BoxPtr extent; + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "ReputImage %d,%d.\n", drw_x, drw_y)); + /* If the buffer was freed, we cannot overlay it. */ + if (pPPriv->display == -1) { + StopOverlay (pPPriv, FALSE); + return Success; + } + if (REGION_SIZE(clipBoxes) != 0) { + /* We need to transform the clipBoxes into a bitmap, + * and upload it to offscreen memory. */ + 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; + } + /* Copy the destinations coordinates */ + pPPriv->dx = drw_x; + pPPriv->dy = drw_y; + + /* We sync the chip. */ + if (pGlint->MultiAperture) DualPermedia3Sync(pScrn); + else Permedia3Sync(pScrn); + + extent = REGION_EXTENTS(pScrn, clipBoxes); + BeginOverlay(pPPriv, -1, pPPriv->Bpp_shift, extent); + + /* We sync the chip. */ + if (pGlint->MultiAperture) DualPermedia3Sync(pScrn); + else Permedia3Sync(pScrn); + + return Success; +} + static int Permedia3PutImage(ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x, short drw_y, @@ -682,21 +721,35 @@ Permedia3PutImage(ScrnInfoPtr pScrn, Bool sync, RegionPtr clipBoxes, pointer data) { PortPrivPtr pPPriv = (PortPrivPtr) data; - AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; GLINTPtr pGlint = GLINTPTR(pScrn); - int i; + int copy = -1; + BoxPtr extent; + BoxRec ext; 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", + "PutImage %d,%d,%d,%d -> %d,%d,%d,%d " + "id=0x%08x buf=%p w=%d h=%d sync=%d\n", src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h, id, buf, width, height, sync)); - /* SVEN : Let's check if the source window is contained in the - * actual source */ + extent = REGION_EXTENTS(pScrn, clipBoxes); + ext = *extent; + if (REGION_SIZE(clipBoxes) != 0) return Success; + + /* Check that the src area to put is included in the buffer. */ if ((src_x + src_w) > width || - (src_y + src_h) > height) + (src_y + src_h) > height || + src_x < 0 || src_y < 0) 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) { + return Success; + } + + /* Copy the source and destinations coordinates and size */ pPPriv->vx = src_x; pPPriv->vy = src_y; pPPriv->vw = src_w; @@ -707,196 +760,183 @@ Permedia3PutImage(ScrnInfoPtr pScrn, pPPriv->dw = drw_w; pPPriv->dh = drw_h; - /* SVEN : Let's check if there is a allocated buffer already of the same - * id, width and height. If yes, use it, if not, we need to allocate one. - */ - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "SVEN : PutImage Do we need to allocate buffers ?\n" - "\t existing : buffers = %d, id = %d, fw = %d, fh = %d.\n" - "\t requested : buffers = %d, id = %d, fw = %d, fh = %d.\n", - pPPriv->BuffersAllocated, pPPriv->Id, pPPriv->fw, pPPriv->fh, - 3, id, width, height)); - - /* Maybe we would test for correct bpp instead of if here, ? */ - if (pPPriv->BuffersAllocated <= 0 || - id != pPPriv->Id || /* same bpp */ - width != pPPriv->fw || - height != pPPriv->fh) - { - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "SVEN : PutImage, yes, we need to allocate buffers, isn't it ?.\n")); - /* SVEN : search for a ScalerImage corresponding to the id */ + /* 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; - - /* SVEN : If no scaler was found, we stop here and then */ if (i >= ENTRIES(ScalerImages)) return XvBadAlloc; + pPPriv->Id = id; + pPPriv->Bpp = ScalerImages[i].bits_per_pixel; + } - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "SVEN : PutImage, We did found a compatible image format (%d).\n", i)); - /* SVEN : Let's sync the chip ... (we do that a lot ...) */ - if (pGlint->MultiAperture) DualPermedia3Sync(pScrn); - else Permedia3Sync(pScrn); -#if 0 /* SVEN : This was not disabled by me, don't know what it was */ - if (pPPriv->BuffersAllocated <= 0 || - pPPriv->Bpp != ScalerImages[i].bits_per_pixel || - width > pPPriv->fw || height > pPPriv->fw || - pPPriv->fw * pPPriv->fh > width * height * 2) -#else - if (1) -#endif - { - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "SVEN : PutImage, We will allocate a buffer ...\n")); - /* SVEN : Let's allocate a buffer to store the image. - * If it is not possible, we exit */ - if (!AllocateBuffers(pPPriv, width, height, - (ScalerImages[i].bits_per_pixel + 7) >> 3, 3, 0)) { - pPPriv->Id = 0; - pPPriv->Bpp = 0; - pPPriv->fw = 0; - pPPriv->fh = 0; - - return XvBadAlloc; - } + /* We sync the chip. I don't know if it is really + * needed but X crashed when i didn't do it. */ + if (pGlint->MultiAperture) DualPermedia3Sync(pScrn); + else Permedia3Sync(pScrn); - /* SVEN : We set the id, bpp, width and height values of - * the allocated buffer, so that we will not need to - * allocate a buffer again on the next frame. */ - pPPriv->Id = id; - pPPriv->Bpp = ScalerImages[i].bits_per_pixel; - pPPriv->fw = width; - pPPriv->fh = height; - - /* SVEN : Add RemoveAreaCallBack to the pFBAreas of each buffer */ - /* Let's see if this cause the crash ??? No, it doesn't ... */ - RemoveableBuffers(pPPriv, TRUE); - } - } else - if (pGlint->MultiAperture) DualPermedia3Sync(pScrn); - else Permedia3Sync(pScrn); + /* Let's define the different strides values */ + pPPriv->OverlayStride = width; + pPPriv->BufferStride = ((pPPriv->Bpp+7)>>3) * width; + /* Now we allocate a buffer, if it is needed */ + if ((copy = AllocateBuffers(pPPriv, pPPriv->BufferStride, height)) == -1) + return XvBadAlloc; + + /* Now, we can copy the image to the buffer */ switch (id) { case LE4CC('Y','V','1','2'): #if X_BYTE_ORDER == X_LITTLE_ENDIAN CopyYV12LE(buf, - (CARD32 *)((CARD8 *) pGlint->FbBase + pPPriv->BufferBase[pPPriv->CurrentBuffer]), + (CARD32 *)((CARD8 *) pGlint->FbBase + + GET_OFFSET(pScrn, pPPriv->Buffer[copy]->offset)), width, height, pPPriv->BufferStride); #else if (pGlint->FBDev) CopyYV12LE(buf, - (CARD32 *)((CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0]), + (CARD32 *)((CARD8 *) pGlint->FbBase + + GET_OFFSET(pScrn, pPPriv->Buffer[copy]->offset)), width, height, pPPriv->BufferStride); else CopyYV12BE(buf, - (CARD32 *)((CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0]), + (CARD32 *)((CARD8 *) pGlint->FbBase + + GET_OFFSET(pScrn, pPPriv->Buffer[copy]->offset)), width, height, pPPriv->BufferStride); #endif - BeginOverlay(pPPriv, pPPriv->BufferBase, pPPriv->CurrentBuffer, FORMAT_YUV422, 1, 0); + pPPriv->Format = FORMAT_YUV422; + pPPriv->Bpp_shift = 1; break; - case LE4CC('Y','U','Y','2'): - CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + CopyFlat(buf, (CARD8 *) pGlint->FbBase + + GET_OFFSET(pScrn, pPPriv->Buffer[copy]->offset), width << 1, height, pPPriv->BufferStride); - BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_YUV422, 1, 0); + pPPriv->Format = FORMAT_YUV422; + pPPriv->Bpp_shift = 1; break; case LE4CC('U','Y','V','Y'): - CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + CopyFlat(buf, (CARD8 *) pGlint->FbBase + + GET_OFFSET(pScrn, pPPriv->Buffer[copy]->offset), width << 1, height, pPPriv->BufferStride); - /* Not sure about this one ... */ - BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_VUY422, 1, 0); + pPPriv->Format = FORMAT_VUY422; + pPPriv->Bpp_shift = 1; break; case LE4CC('Y','U','V','A'): - CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + CopyFlat(buf, (CARD8 *) pGlint->FbBase + + GET_OFFSET(pScrn, pPPriv->Buffer[copy]->offset), width << 2, height, pPPriv->BufferStride); - BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_YUV444, 2, pPPriv->Attribute[7]); + pPPriv->Format = FORMAT_YUV444; + pPPriv->Bpp_shift = 2; break; case LE4CC('V','U','Y','A'): - CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + CopyFlat(buf, (CARD8 *) pGlint->FbBase + + GET_OFFSET(pScrn, pPPriv->Buffer[copy]->offset), width << 2, height, pPPriv->BufferStride); - BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_VUY444, 2, pPPriv->Attribute[7]); + pPPriv->Format = FORMAT_VUY444; + pPPriv->Bpp_shift = 2; break; case 0x41: /* RGBA 8:8:8:8 */ - CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + CopyFlat(buf, (CARD8 *) pGlint->FbBase + + GET_OFFSET(pScrn, pPPriv->Buffer[copy]->offset), width << 2, height, pPPriv->BufferStride); - BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_RGB8888, 2, pPPriv->Attribute[7]); + pPPriv->Format = FORMAT_RGB8888; + pPPriv->Bpp_shift = 2; break; case 0x42: /* RGB 5:6:5 */ - CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + CopyFlat(buf, (CARD8 *) pGlint->FbBase + + GET_OFFSET(pScrn, pPPriv->Buffer[copy]->offset), width << 1, height, pPPriv->BufferStride); - BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_RGB565, 1, 0); + pPPriv->Format = FORMAT_RGB565; + pPPriv->Bpp_shift = 1; break; case 0x43: /* RGB 1:5:5:5 */ - CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + CopyFlat(buf, (CARD8 *) pGlint->FbBase + + GET_OFFSET(pScrn, pPPriv->Buffer[copy]->offset), width << 1, height, pPPriv->BufferStride); - BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_RGB5551, 1, pPPriv->Attribute[7]); + pPPriv->Format = FORMAT_RGB5551; + pPPriv->Bpp_shift = 1; break; case 0x44: /* RGB 4:4:4:4 */ - CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + CopyFlat(buf, (CARD8 *) pGlint->FbBase + + GET_OFFSET(pScrn, pPPriv->Buffer[copy]->offset), width << 1, height, pPPriv->BufferStride); - BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_RGB4444, 1, pPPriv->Attribute[7]); + pPPriv->Format = FORMAT_RGB4444; + pPPriv->Bpp_shift = 1; break; case 0x46: /* RGB 2:3:3 */ - CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + CopyFlat(buf, (CARD8 *) pGlint->FbBase + + GET_OFFSET(pScrn, pPPriv->Buffer[copy]->offset), width, height, pPPriv->BufferStride); - BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_RGB332, 0, 0); + pPPriv->Format = FORMAT_RGB332; + pPPriv->Bpp_shift = 0; break; case 0x47: /* BGRA 8:8:8:8 */ - CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + CopyFlat(buf, (CARD8 *) pGlint->FbBase + + GET_OFFSET(pScrn, pPPriv->Buffer[copy]->offset), width << 2, height, pPPriv->BufferStride); - BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_BGR8888, 2, pPPriv->Attribute[7]); + pPPriv->Format = FORMAT_BGR8888; + pPPriv->Bpp_shift = 2; break; case 0x48: /* BGR 5:6:5 */ - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "PutImage case (13) BGR565.\n")); - CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + CopyFlat(buf, (CARD8 *) pGlint->FbBase + + GET_OFFSET(pScrn, pPPriv->Buffer[copy]->offset), width << 1, height, pPPriv->BufferStride); - BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_BGR565, 1, 0); + pPPriv->Format = FORMAT_BGR565; + pPPriv->Bpp_shift = 1; break; case 0x49: /* BGR 1:5:5:5 */ - CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + CopyFlat(buf, (CARD8 *) pGlint->FbBase + + GET_OFFSET(pScrn, pPPriv->Buffer[copy]->offset), width << 1, height, pPPriv->BufferStride); - BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_BGR5551, 1, pPPriv->Attribute[7]); + pPPriv->Format = FORMAT_BGR5551; + pPPriv->Bpp_shift = 1; break; case 0x4A: /* BGR 4:4:4:4 */ - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "PutImage case (15) BGR4444.\n")); - CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + CopyFlat(buf, (CARD8 *) pGlint->FbBase + + GET_OFFSET(pScrn, pPPriv->Buffer[copy]->offset), width << 1, height, pPPriv->BufferStride); - BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_BGR4444, 1, pPPriv->Attribute[7]); + pPPriv->Format = FORMAT_BGR4444; + pPPriv->Bpp_shift = 1; break; case 0x4C: /* BGR 2:3:3 */ - CopyFlat(buf, (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[0], + CopyFlat(buf, (CARD8 *) pGlint->FbBase + + GET_OFFSET(pScrn, pPPriv->Buffer[copy]->offset), width << 0, height, pPPriv->BufferStride); - BeginOverlay(pPPriv, pPPriv->BufferBase, 0, FORMAT_BGR332, 0, 0); + pPPriv->Format = FORMAT_BGR332; + pPPriv->Bpp_shift = 0; break; - default: return XvBadAlloc; } + /* We sync the chip. */ + if (pGlint->MultiAperture) DualPermedia3Sync(pScrn); + else Permedia3Sync(pScrn); - /* SVEN : Don't know what these two are for, let them stay as is */ - pPPriv->StopDelay = pAPriv->Delay; - if (!pAPriv->TimerUsers) { - pAPriv->TimerUsers |= 1 << PORTNUM(pPPriv); - TimerSet(pAPriv->Timer, 0, 80, TimerCallback, pAPriv); - } + /* Don't know why we need this, + * but the server will crash if i remove it. */ + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Starting the overlay.\n"); + + /* We start the overlay */ + BeginOverlay(pPPriv, copy, pPPriv->Bpp_shift, extent); + /* We sync the chip again. */ if (sync) { if (pGlint->MultiAperture) DualPermedia3Sync(pScrn); else Permedia3Sync(pScrn); @@ -909,20 +949,14 @@ static void Permedia3StopVideo(ScrnInfoPtr pScrn, pointer data, Bool cleanup) { PortPrivPtr pPPriv = (PortPrivPtr) data; - AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "StopVideo port=%d, exit=%d\n", PORTNUM(pPPriv), cleanup)); + "StopVideo : exit=%d\n", cleanup)); - StopOverlay(pPPriv, pPPriv->BufferBase, pPPriv->CurrentBuffer, cleanup); + StopOverlay(pPPriv, cleanup); if (cleanup) { - FreeBuffers(pPPriv); - if (pAPriv->TimerUsers) { - pAPriv->TimerUsers &= ~PORTNUM(pPPriv); - if (!pAPriv->TimerUsers) - TimerCancel(pAPriv->Timer); - } + FreeBuffers(pPPriv, FALSE); } } @@ -931,11 +965,131 @@ Permedia3SetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value, pointer data) { PortPrivPtr pPPriv = (PortPrivPtr) data; - AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; + + /* Note, we could decode and store attributes directly here */ + if (attribute == xvFilter) { + switch (value) { + case 0: /* No Filtering */ + pPPriv->OverlayMode = + (pPPriv->OverlayMode & + ~PM3VideoOverlayMode_FILTER_MASK) | + PM3VideoOverlayMode_FILTER_OFF; + break; + case 1: /* No Filtering */ + pPPriv->OverlayMode = + (pPPriv->OverlayMode & + ~PM3VideoOverlayMode_FILTER_MASK) | + PM3VideoOverlayMode_FILTER_PARTIAL; + break; + case 2: /* No Filtering */ + pPPriv->OverlayMode = + (pPPriv->OverlayMode & + ~PM3VideoOverlayMode_FILTER_MASK) | + PM3VideoOverlayMode_FILTER_FULL; + 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 */ + 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 */ + pPPriv->OverlayMode = + (pPPriv->OverlayMode & + ~PM3VideoOverlayMode_MIRROR_MASK) | + PM3VideoOverlayMode_MIRRORX_ON | + PM3VideoOverlayMode_MIRRORY_ON; + break; + default: + return BadValue; + } + pPPriv->Attribute[1] = value; + } + else if (attribute == xvOverlayMode) { + pPPriv->OverlayControl = + PM3RD_VideoOverlayControl_ENABLE; + switch (value&&0xff) { + case 0: /* Opaque video overlay */ + pPPriv->OverlayData = + OVERLAY_DATA_NONE; + pPPriv->OverlayControl = + PM3RD_VideoOverlayControl_MODE_ALWAYS; + break; + case 1: /* Color keyed overlay, framebuffer color key */ + pPPriv->OverlayData = + OVERLAY_DATA_COLORKEY; + pPPriv->OverlayControl = + /* color key in RGB 888 mode */ + ((value<<5)&0xffffff00) | + PM3RD_VideoOverlayControl_MODE_MAINKEY | + PM3RD_VideoOverlayControl_KEY_COLOR; + break; + case 2: /* Color keyed overlay, framebuffer alpha key */ + pPPriv->OverlayData = + OVERLAY_DATA_ALPHAKEY; + pPPriv->OverlayControl = + /* 8 bit alpha key */ + ((value<<5)&0xff00) | + PM3RD_VideoOverlayControl_MODE_MAINKEY | + PM3RD_VideoOverlayControl_KEY_ALPHA; + break; + case 3: /* Color keyed overlay, overlay color key */ + pPPriv->OverlayData = + OVERLAY_DATA_COLORKEY; + pPPriv->OverlayControl = + /* color key in RGB 888 mode */ + ((value<<5)&0xffffff00) | + PM3RD_VideoOverlayControl_MODE_OVERLAYKEY; + break; + case 4: /* Per pixel alpha blending */ + pPPriv->OverlayData = + OVERLAY_DATA_NONE; + pPPriv->OverlayControl = + PM3RD_VideoOverlayControl_MODE_BLEND | + PM3RD_VideoOverlayControl_BLENDSRC_MAIN; + break; + case 5: /* Constant alpha blending */ + pPPriv->OverlayData = + OVERLAY_DATA_ALPHABLEND; + pPPriv->OverlayControl = + /* 8 bit alpha blend factor + * (only the 2 top bits are used) */ + ((value<<5)&0xff00) | + PM3RD_VideoOverlayControl_MODE_BLEND | + PM3RD_VideoOverlayControl_BLENDSRC_REGISTER; + break; + default: + return BadValue; + } + pPPriv->Attribute[2] = value; + } + else return BadMatch; DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "SPA attr=%d val=%d port=%d\n", - attribute, value, PORTNUM(pPPriv))); + "SPA attr=%d val=%d\n", + attribute, value)); return Success; } @@ -945,43 +1099,18 @@ Permedia3GetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 *value, pointer data) { PortPrivPtr pPPriv = (PortPrivPtr) data; - AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; - - if (PORTNUM(pPPriv) >= 2 && - attribute != xvFilter && - attribute != xvAlpha) - return BadMatch; - if (attribute == xvEncoding) { - if (pAPriv->VideoStd < 0) - return XvBadAlloc; - else - if (pPPriv == &pAPriv->Port[0]) - *value = pAPriv->VideoStd * 3 + pPPriv->Plug; - else - *value = pAPriv->VideoStd * 2 + pPPriv->Plug - 1; - } else if (attribute == xvBrightness) + if (attribute == xvFilter) *value = pPPriv->Attribute[0]; - else if (attribute == xvContrast) + else if (attribute == xvMirror) *value = pPPriv->Attribute[1]; - else if (attribute == xvSaturation) + else if (attribute == xvOverlayMode) *value = pPPriv->Attribute[2]; - else if (attribute == xvHue) - *value = pPPriv->Attribute[3]; - else if (attribute == xvInterlace) - *value = pPPriv->Attribute[4]; - else if (attribute == xvFilter) - *value = pPPriv->Attribute[5]; - else if (attribute == xvBkgColor) - *value = pPPriv->Attribute[6]; - else if (attribute == xvAlpha) - *value = pPPriv->Attribute[7]; - else - return BadMatch; + else return BadMatch; DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "GPA attr=%d val=%d port=%d\n", - attribute, *value, PORTNUM(pPPriv))); + "GPA attr=%d val=%d\n", + attribute, *value)); return Success; } @@ -1063,13 +1192,9 @@ Permedia3QueryImageAttributes(ScrnInfoPtr pScrn, static void DeleteAdaptorPriv(AdaptorPrivPtr pAPriv) { - int i; + FreeBuffers(pAPriv->pPort, FALSE); - for (i = 0; i < PORTS; i++) { - FreeBuffers(&pAPriv->Port[i]); - } - - TimerFree(pAPriv->Timer); + TimerFree(pAPriv->pPort->Timer); xfree(pAPriv); } @@ -1078,35 +1203,51 @@ static AdaptorPrivPtr NewAdaptorPriv(ScrnInfoPtr pScrn) { AdaptorPrivPtr pAPriv = (AdaptorPrivPtr) xcalloc(1, sizeof(AdaptorPrivRec)); + PortPrivPtr pPPriv = (PortPrivPtr) xcalloc(1, sizeof(PortPrivRec)); int i; if (!pAPriv) return NULL; - pAPriv->pScrn = pScrn; + if (!pPPriv) return NULL; + pAPriv->pPort = pPPriv; + - if (!(pAPriv->Timer = TimerSet(NULL, 0, 0, TimerCallback, pAPriv))) { + /* We allocate a timer */ + if (!(pPPriv->Timer = TimerSet(NULL, 0, 0, TimerCallback, pPPriv))) { DeleteAdaptorPriv(pAPriv); return NULL; } - for (i = 0; i < PORTS; i++) { - pAPriv->Port[i].pAdaptor = pAPriv; - - pAPriv->Port[i].StopDelay = -1; - pAPriv->Port[i].fw = 0; - pAPriv->Port[i].fh = 0; - pAPriv->Port[i].BuffersRequested = 1; - pAPriv->Delay = 125; - pAPriv->Instant = 1000 / 25; + /* Attributes */ + pPPriv->pAdaptor = pAPriv; + pPPriv->Attribute[0] = 0; /* Full filtering enabled */ + pPPriv->Attribute[1] = 0; /* No mirroring */ + pPPriv->Attribute[2] = 0; /* Opaque overlay mode */ + pPPriv->OverlayData = 0; + pPPriv->OverlayMode = + PM3VideoOverlayMode_FILTER_FULL | + PM3VideoOverlayMode_MIRRORX_OFF | + PM3VideoOverlayMode_MIRRORY_OFF; + pPPriv->OverlayControl = + PM3RD_VideoOverlayControl_ENABLE | + PM3RD_VideoOverlayControl_MODE_ALWAYS; + + /* Buffers */ + pPPriv->Id = ScalerImages[0].id; + pPPriv->Bpp = ScalerImages[0].bits_per_pixel; + pPPriv->copy = -1; + pPPriv->display = -1; + for (i = 0; i < MAX_BUFFERS; i++) + pPPriv->Buffer[i] = NULL; - pAPriv->Port[i].Attribute[5] = 0; /* Bilinear Filter (Bool) */ - pAPriv->Port[i].Attribute[7] = 0; /* Alpha Enable (Bool) */ - } + /* Timer */ + pPPriv->StopDelay = -1; + pPPriv->Delay = 125; + pPPriv->Instant = 1000 / 25; return pAPriv; } - /* * Glint interface */ @@ -1114,42 +1255,22 @@ NewAdaptorPriv(ScrnInfoPtr pScrn) void Permedia3VideoEnterVT(ScrnInfoPtr pScrn) { - AdaptorPrivPtr pAPriv; - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv enter VT\n")); - - for (pAPriv = AdaptorPrivList; pAPriv != NULL; pAPriv = pAPriv->Next) - if (pAPriv->pScrn == pScrn) { - /* SVEN : nothing is done here, since we disabled - * input/ouput video support. */ - } } void Permedia3VideoLeaveVT(ScrnInfoPtr pScrn) { - AdaptorPrivPtr pAPriv; - - for (pAPriv = AdaptorPrivList; pAPriv != NULL; pAPriv = pAPriv->Next) - if (pAPriv->pScrn == pScrn) { - /* SVEN : nothing is done here, since we disabled - * input/ouput video support. */ - } - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv leave VT\n")); } void Permedia3VideoUninit(ScrnInfoPtr pScrn) { - AdaptorPrivPtr pAPriv, *ppAPriv; - - for (ppAPriv = &AdaptorPrivList; (pAPriv = *ppAPriv); ppAPriv = &(pAPriv->Next)) - if (pAPriv->pScrn == pScrn) { - *ppAPriv = pAPriv->Next; - DeleteAdaptorPriv(pAPriv); - break; - } + if (AdaptorPriv->pScrn == pScrn) { + DeleteAdaptorPriv(AdaptorPriv); + AdaptorPriv = NULL; + } DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv cleanup\n")); } @@ -1159,43 +1280,43 @@ Permedia3VideoInit(ScreenPtr pScreen) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; GLINTPtr pGlint = GLINTPTR(pScrn); AdaptorPrivPtr pAPriv; - DevUnion Private[PORTS]; + DevUnion Private[1]; XF86VideoAdaptorRec VAR; XF86VideoAdaptorPtr VARPtrs; - int i; switch (pGlint->Chipset) { case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: break; - case PCI_VENDOR_3DLABS_CHIP_GAMMA: if (pGlint->MultiChip == PCI_CHIP_PERMEDIA3) break; - default: xf86DrvMsgVerb(pScrn->scrnIndex, X_ERROR, 1, "No Xv support for chipset %d.\n", pGlint->Chipset); return; } + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 1, + "Initializing Permedia3 Xv driver rev. 1\n"); + if (pGlint->NoAccel) { xf86DrvMsgVerb(pScrn->scrnIndex, X_ERROR, 1, - "Sorry, need to enable accel for Xv support for Permedia3.\n"); + "Xv : Sorry, Xv is not supported without accelerations"); return; +#if 0 /* This works, but crashes the X server after a time. */ + xf86DrvMsgVerb(pScrn->scrnIndex, X_ERROR, 1, + "Xv : Acceleration disabled, starting offscreen memory manager\n."); + Permedia3EnableOffscreen (pScreen); +#endif } - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 1, - "Initializing Xv driver rev. 1\n"); - if (!(pAPriv = NewAdaptorPriv(pScrn))) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Xv driver initialization failed\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Xv initialization failed\n"); return; } memset(&VAR, 0, sizeof(VAR)); - for (i = 0; i < PORTS; i++) - Private[i].ptr = (pointer) &pAPriv->Port[i]; + Private[0].ptr = (pointer) pAPriv->pPort; VARPtrs = &VAR; @@ -1206,7 +1327,7 @@ Permedia3VideoInit(ScreenPtr pScreen) VAR.pEncodings = ScalerEncodings; VAR.nFormats = ENTRIES(ScalerVideoFormats); VAR.pFormats = ScalerVideoFormats; - VAR.nPorts = 3; + VAR.nPorts = 1; VAR.pPortPrivates = &Private[0]; VAR.nAttributes = ENTRIES(ScalerAttributes); VAR.pAttributes = ScalerAttributes; @@ -1222,22 +1343,16 @@ Permedia3VideoInit(ScreenPtr pScreen) VAR.GetPortAttribute = Permedia3GetPortAttribute; VAR.QueryBestSize = Permedia3QueryBestSize; VAR.PutImage = Permedia3PutImage; + VAR.ReputImage = Permedia3ReputImage; VAR.QueryImageAttributes = Permedia3QueryImageAttributes; if (xf86XVScreenInit(pScreen, &VARPtrs, 1)) { - xvEncoding = MAKE_ATOM(XV_ENCODING); - xvHue = MAKE_ATOM(XV_HUE); - xvSaturation = MAKE_ATOM(XV_SATURATION); - xvBrightness = MAKE_ATOM(XV_BRIGHTNESS); - xvContrast = MAKE_ATOM(XV_CONTRAST); - xvInterlace = MAKE_ATOM(XV_INTERLACE); xvFilter = MAKE_ATOM(XV_FILTER); - xvBkgColor = MAKE_ATOM(XV_BKGCOLOR); - xvAlpha = MAKE_ATOM(XV_ALPHA); + xvMirror = MAKE_ATOM(XV_MIRROR); + xvOverlayMode = MAKE_ATOM(XV_OVERLAY_MODE); /* Add it to the AdaptatorList */ - pAPriv->Next = AdaptorPrivList; - AdaptorPrivList = pAPriv; + AdaptorPriv = pAPriv; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Xv frontend scaler enabled\n"); } else { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c index 684aa3686..ed833ea72 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c @@ -28,7 +28,7 @@ * * GLINT 300SX accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c,v 1.5 2001/02/02 11:45:58 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c,v 1.6 2001/04/19 09:28:32 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -595,7 +595,6 @@ SXWriteBitmap(ScrnInfoPtr pScrn, SXLoadCoord(pScrn, x, y, x+w, h, 0, 1); if(bg == -1) { - /* >>>>> set fg <<<<<<<< */ REPLICATE(fg); GLINT_WAIT(3); if (rop == GXcopy) { 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 1909ffada..95db91fa7 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.25 2001/02/07 13:26:21 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c,v 1.26 2001/04/19 09:28:32 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -117,12 +117,10 @@ TXInitializeEngine(ScrnInfoPtr pScrn) /* Make sure the rest of the register writes go to both chip's */ GLINT_SLOW_WRITE_REG(3, BroadcastMask); - GLINT_SLOW_WRITE_REG(pGlint->pprod | LBRM_ScanlineInt2, LBReadMode); pGlint->pprod |= FBRM_ScanlineInt2; - } else { - GLINT_SLOW_WRITE_REG(pGlint->pprod, LBReadMode); } + GLINT_SLOW_WRITE_REG(pGlint->pprod, LBReadMode); GLINT_SLOW_WRITE_REG(pGlint->rasterizerMode, RasterizerMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ScissorMode); GLINT_SLOW_WRITE_REG(pGlint->pprod, FBReadMode); @@ -694,7 +692,6 @@ TXWriteBitmap(ScrnInfoPtr pScrn, TXLoadCoord(pScrn, x, y, x+w, h, 0, 1); if(bg == -1) { - /* >>>>> set fg <<<<<<<< */ REPLICATE(fg); GLINT_WAIT(3); if (rop == GXcopy) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/tx_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/tx_dac.c index fe72872e4..b33ca8ced 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/tx_dac.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/tx_dac.c @@ -27,7 +27,7 @@ * this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen and * Siemens Nixdorf Informationssysteme */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/tx_dac.c,v 1.12 2001/01/31 17:09:10 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/tx_dac.c,v 1.13 2001/04/19 09:28:32 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -72,7 +72,7 @@ TXInit(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg) pGlint->MultiPciInfo[1]->memBase[2] & 0xFF800000); } - if (IS_GMX2000) { + if (IS_GMX2000 || IS_GLORIAXXL) { pReg->glintRegs[LBMemoryEDO >> 3] = GLINT_READ_REG(LBMemoryEDO); pReg->glintRegs[LBMemoryEDO >> 3] &= ~(LBEDOMask | LBEDOBankSizeMask | @@ -146,7 +146,6 @@ TXInit(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg) STOREREG(VTGHGateEnd, Shiftbpp(pScrn, mode->CrtcHTotal) - 1); STOREREG(FBModeSel, 0x907); STOREREG(VTGModeCtl, 0x04); - STOREREG(FBMemoryCtl, 0x0800); } else { STOREREG(VTGSerialClk, 0x05); STOREREG(VTGHGateStart, @@ -156,6 +155,9 @@ TXInit(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg) STOREREG(VTGModeCtl, 0x44); } + if (IS_GMX2000 || IS_GLORIAXXL) + STOREREG(FBMemoryCtl, 0x800); /* Optimum memory timings */ + /* Override FBModeSel for 300SX chip */ if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_300SX) { switch (pScrn->bitsPerPixel) { @@ -332,9 +334,9 @@ TXSave(ScrnInfoPtr pScrn, GLINTRegPtr pReg) SAVEREG(FBModeSel); SAVEREG(VTGHGateStart); SAVEREG(VTGHGateEnd); + SAVEREG(FBMemoryCtl); - if (IS_GMX2000) { - SAVEREG(FBMemoryCtl); + if (IS_GMX2000 || IS_GLORIAXXL) { SAVEREG(LBMemoryEDO); SAVEREG(LBMemoryCtl); } @@ -381,9 +383,9 @@ TXRestore(ScrnInfoPtr pScrn, GLINTRegPtr pReg) RESTOREREG(FBModeSel); RESTOREREG(VTGHGateStart); RESTOREREG(VTGHGateEnd); + RESTOREREG(FBMemoryCtl); - if (IS_GMX2000) { - RESTOREREG(FBMemoryCtl); + if (IS_GMX2000 || IS_GLORIAXXL) { RESTOREREG(LBMemoryEDO); RESTOREREG(LBMemoryCtl); } 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 e99307a7f..7bf02f271 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.17 2001/03/21 19:46:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.18 2001/04/10 16:08:00 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -112,17 +112,17 @@ I810InitVisualConfigs(ScreenPtr pScreen) case 16: numConfigs = 8; - pConfigs = (__GLXvisualConfig *) xnfcalloc(sizeof(__GLXvisualConfig), numConfigs); + pConfigs = (__GLXvisualConfig *) xcalloc(sizeof(__GLXvisualConfig), numConfigs); if (!pConfigs) return FALSE; - pI810Configs = (I810ConfigPrivPtr) xnfcalloc(sizeof(I810ConfigPrivRec), numConfigs); + pI810Configs = (I810ConfigPrivPtr) xcalloc(sizeof(I810ConfigPrivRec), numConfigs); if (!pI810Configs) { xfree(pConfigs); return FALSE; } - pI810ConfigPtrs = (I810ConfigPrivPtr *) xnfcalloc(sizeof(I810ConfigPrivPtr), numConfigs); + pI810ConfigPtrs = (I810ConfigPrivPtr *) xcalloc(sizeof(I810ConfigPrivPtr), numConfigs); if (!pI810ConfigPtrs) { xfree(pConfigs); xfree(pI810Configs); @@ -294,7 +294,7 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) } pDRIInfo->SAREASize = SAREA_MAX; - if (!(pI810DRI = (I810DRIPtr)xnfcalloc(sizeof(I810DRIRec),1))) { + if (!(pI810DRI = (I810DRIPtr)xcalloc(sizeof(I810DRIRec),1))) { DRIDestroyInfoRec(pI810->pDRIInfo); pI810->pDRIInfo=0; return FALSE; 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 1d4be078c..603baf7d4 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.44 2001/03/02 02:45:38 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.46 2001/04/18 14:52:41 dawes Exp $ */ /* * Authors: @@ -551,14 +551,6 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) { if (!xf86SetDefaultVisual(pScrn, -1)) return FALSE; - /* We don't currently support DirectColor at > 8bpp */ - if ((pScrn->depth > 8) && (pScrn->defaultVisual != TrueColor)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual" - " (%s) is not supported at depth %d\n", - xf86GetVisualName(pScrn->defaultVisual), pScrn->depth); - return FALSE; - } - /* We use a programamble clock */ pScrn->progClock = TRUE; @@ -1383,6 +1375,9 @@ I810SetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) pVga->CRTC[0x13] = pScrn->displayWidth >> 2; i810Reg->ExtOffset = pScrn->displayWidth >> 10; i810Reg->BitBLTControl = COLEXP_16BPP; + + /* Enable Palette Programming for Direct Color visuals. -jens */ + i810Reg->PixelPipeCfg2 = DISPLAY_GAMMA_ENABLE; break; case 24: pVga->CRTC[0x13] = (pScrn->displayWidth * 3) >> 3; @@ -1390,6 +1385,9 @@ I810SetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) i810Reg->PixelPipeCfg1 = DISPLAY_24BPP_MODE; i810Reg->BitBLTControl = COLEXP_24BPP; + + /* Enable Palette Programming for Direct Color visuals. -jens */ + i810Reg->PixelPipeCfg2 = DISPLAY_GAMMA_ENABLE; break; default: break; @@ -1538,23 +1536,58 @@ I810LoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, pI810 = I810PTR(pScrn); hwp = VGAHWPTR(pScrn); + + /* Load all four entries in each of the 64 color ranges. -jens */ for (i=0; i<numColors; i++) { index=indices[i/2]; r=colors[index].red; b=colors[index].blue; index=indices[i]; g=colors[index].green; + hwp->writeDacWriteAddr(hwp, index<<2); hwp->writeDacData(hwp, r); hwp->writeDacData(hwp, g); hwp->writeDacData(hwp, b); + + hwp->writeDacWriteAddr(hwp, (index<<2)+1); + hwp->writeDacData(hwp, r); + hwp->writeDacData(hwp, g); + hwp->writeDacData(hwp, b); + + hwp->writeDacWriteAddr(hwp, (index<<2)+2); + hwp->writeDacData(hwp, r); + hwp->writeDacData(hwp, g); + hwp->writeDacData(hwp, b); + + hwp->writeDacWriteAddr(hwp, (index<<2)+3); + hwp->writeDacData(hwp, r); + hwp->writeDacData(hwp, g); + hwp->writeDacData(hwp, b); + i++; index=indices[i]; g=colors[index].green; + hwp->writeDacWriteAddr(hwp, index<<2); hwp->writeDacData(hwp, r); hwp->writeDacData(hwp, g); hwp->writeDacData(hwp, b); + + hwp->writeDacWriteAddr(hwp, (index<<2)+1); + hwp->writeDacData(hwp, r); + hwp->writeDacData(hwp, g); + hwp->writeDacData(hwp, b); + + hwp->writeDacWriteAddr(hwp, (index<<2)+2); + hwp->writeDacData(hwp, r); + hwp->writeDacData(hwp, g); + hwp->writeDacData(hwp, b); + + hwp->writeDacWriteAddr(hwp, (index<<2)+3); + hwp->writeDacData(hwp, r); + hwp->writeDacData(hwp, g); + hwp->writeDacData(hwp, b); } } @@ -1568,12 +1601,12 @@ I810LoadPalette24(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, pI810 = I810PTR(pScrn); hwp = VGAHWPTR(pScrn); + for (i=0; i<numColors; i++) { index=indices[i]; r=colors[index].red; - b=colors[index].blue; - index=indices[i]; g=colors[index].green; + b=colors[index].blue; hwp->writeDacWriteAddr(hwp, index); hwp->writeDacData(hwp, r); hwp->writeDacData(hwp, g); @@ -1663,6 +1696,7 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { vgaHWPtr hwp; I810Ptr pI810; VisualPtr visual; + MessageType driFrom = X_DEFAULT; pScrn = xf86Screens[pScreen->myNum]; pI810 = I810PTR(pScrn); @@ -1672,18 +1706,10 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { miClearVisualTypes(); -#if 1 /* disable DirectColor */ - if(pScrn->depth > 8) { - if (!miSetVisualTypes(pScrn->depth, TrueColorMask, - pScrn->rgbBits, pScrn->defaultVisual)) - return FALSE; - } else -#endif - { - if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), - pScrn->rgbBits, pScrn->defaultVisual)) - return FALSE; - } + /* Re-implemented Direct Color support, -jens */ + if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), + pScrn->rgbBits, pScrn->defaultVisual)) + return FALSE; if (!miSetPixmapDepths ()) return FALSE; @@ -1709,11 +1735,12 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { * InitGLXVisuals call back. */ - if (!xf86ReturnOptValBool(I810Options, OPTION_NOACCEL, FALSE) && - xf86ReturnOptValBool(I810Options, OPTION_DRI, TRUE)) { - pI810->directRenderingEnabled = I810DRIScreenInit(pScreen); - } else { + if (xf86ReturnOptValBool(I810Options, OPTION_NOACCEL, FALSE) || + !xf86ReturnOptValBool(I810Options, OPTION_DRI, TRUE)) { pI810->directRenderingEnabled = FALSE; + driFrom = X_CONFIG; + } else { + pI810->directRenderingEnabled = I810DRIScreenInit(pScreen); } #else @@ -1726,7 +1753,7 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { if (!I810MapMem(pScrn)) return FALSE; - pScrn->memPhysBase = (unsigned long)pI810->FbBase; + pScrn->memPhysBase = (unsigned long)pI810->LinearAddr; pScrn->fbOffset = 0; vgaHWSetMmioFuncs(hwp, pI810->MMIOBase, 0); @@ -1767,7 +1794,8 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { #ifdef XF86DRI if (pI810->LpRing.mem.Start == 0 && pI810->directRenderingEnabled) { - pI810->directRenderingEnabled = 0; + pI810->directRenderingEnabled = FALSE; + driFrom = X_PROBED; I810DRICloseScreen(pScreen); } @@ -1814,7 +1842,7 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { if (!miCreateDefColormap(pScreen)) return FALSE; -#if 0 /* palettes do not work */ + /* Use driver specific palette load routines for Direct Color support. -jens */ if (pScrn->bitsPerPixel==16) { if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette16, 0, CMAP_PALETTED_TRUECOLOR| @@ -1826,10 +1854,6 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { CMAP_RELOAD_ON_MODE_SWITCH)) return FALSE; } -#else - if (!vgaHWHandleColormaps(pScreen)) - return FALSE; -#endif xf86DPMSInit(pScreen, I810DisplayPowerManagementSet, 0); @@ -1845,15 +1869,9 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { #endif if (pI810->directRenderingEnabled) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: Enabled\n"); + xf86DrvMsg(pScrn->scrnIndex, driFrom, "Direct rendering enabled\n"); } else { - if(pI810->agpAcquired2d == TRUE) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: Disabled\n"); - } - else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: Failed\n"); - return FALSE; - } + xf86DrvMsg(pScrn->scrnIndex, driFrom, "Direct rendering disabled\n"); } pScreen->SaveScreen = I810SaveScreen; 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 b1ab66cb0..a5085ddc1 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c @@ -23,14 +23,15 @@ 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.16 2001/01/30 19:23:55 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c,v 1.17 2001/04/18 14:52:41 dawes Exp $ */ /* * i810_video.c: i810 Xv driver. Based on the mga Xv driver by Mark Vojkovich. * * Authors: * Jonathan Bian <jonathan.bian@intel.com> - * + * Offscreen Images: + * Matt Sottek <matthew.j.sottek@intel.com> */ #include "xf86.h" @@ -60,6 +61,8 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define TIMER_MASK (OFF_TIMER | FREE_TIMER) +static void I810InitOffscreenImages(ScreenPtr); + static XF86VideoAdaptorPtr I810SetupImageVideo(ScreenPtr); static void I810StopVideo(ScrnInfoPtr, pointer, Bool); static int I810SetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); @@ -155,6 +158,7 @@ void I810InitVideo(ScreenPtr pScreen) if (pScrn->bitsPerPixel != 8) { newAdaptor = I810SetupImageVideo(pScreen); + I810InitOffscreenImages(pScreen); } num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); @@ -1133,3 +1137,236 @@ I810BlockHandler ( } } } + + +/*************************************************************************** + * Offscreen Images + ***************************************************************************/ + +typedef struct { + FBLinearPtr linear; + Bool isOn; +} OffscreenPrivRec, * OffscreenPrivPtr; + +static int +I810AllocateSurface( + ScrnInfoPtr pScrn, + int id, + unsigned short w, + unsigned short h, + XF86SurfacePtr surface +){ + FBLinearPtr linear; + int pitch, fbpitch, size, bpp; + OffscreenPrivPtr pPriv; + I810Ptr pI810 = I810PTR(pScrn); + + if((w > 1024) || (h > 1024)) + 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 = I810AllocateMemory(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] = linear->offset * bpp; + surface->devPrivate.ptr = (pointer)pPriv; + + memset(pI810->FbBase + surface->offsets[0],0,size); + + return Success; +} + +static int +I810StopSurface( + XF86SurfacePtr surface +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + + if(pPriv->isOn) { + I810Ptr pI810 = I810PTR(surface->pScrn); + + I810OverlayRegPtr overlay = (I810OverlayRegPtr) (pI810->FbBase + pI810->OverlayStart); + + overlay->OV0CMD &= 0xFFFFFFFE; + OVERLAY_UPDATE(pI810->OverlayPhysical); + + pPriv->isOn = FALSE; + } + + return Success; +} + + +static int +I810FreeSurface( + XF86SurfacePtr surface +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + + if(pPriv->isOn) { + I810StopSurface(surface); + } + xf86FreeOffscreenLinear(pPriv->linear); + xfree(surface->pitches); + xfree(surface->offsets); + xfree(surface->devPrivate.ptr); + + return Success; +} + +static int +I810GetSurfaceAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value +){ + return I810GetPortAttribute(pScrn, attribute, value, 0); +} + +static int +I810SetSurfaceAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 value +){ + return I810SetPortAttribute(pScrn, attribute, value, 0); +} + + +static int +I810DisplaySurface( + 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; + I810Ptr pI810 = I810PTR(pScrn); + I810PortPrivPtr pI810Priv = GET_PORT_PRIVATE(pScrn); + + INT32 x1, y1, x2, y2; + INT32 loops = 0; + 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; + + I810ClipVideo(&dstBox, &x1, &x2, &y1, &y2, + REGION_EXTENTS(screenInfo.screens[0], clipBoxes), + surface->width, surface->height); + + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; + + /* fixup pointers */ + pI810Priv->YBuf0offset = surface->offsets[0]; + pI810Priv->YBuf1offset = pI810Priv->YBuf0offset; + + /* wait for the last rendered buffer to be flipped in */ + while (((INREG(DOV0STA)&0x00100000)>>20) != pI810Priv->currentBuf) { + if(loops == 200000) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Overlay Lockup\n"); + break; + } + loops++; + } + + /* buffer swap */ + if (pI810Priv->currentBuf == 0) + pI810Priv->currentBuf = 1; + else + pI810Priv->currentBuf = 0; + + I810ResetVideo(pScrn); + + I810DisplayVideo(pScrn, surface->id, surface->width, surface->height, + surface->pitches[0], x1, y1, x2, y2, &dstBox, + src_w, src_h, drw_w, drw_h); + + XAAFillSolidRects(pScrn, pI810Priv->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(pI810Priv->videoStatus & CLIENT_VIDEO_ON) { + REGION_EMPTY(pScrn->pScreen, & pI810Priv->clip); + UpdateCurrentTime(); + pI810Priv->videoStatus = FREE_TIMER; + pI810Priv->freeTime = currentTime.milliseconds + FREE_DELAY; + pScrn->pScreen->BlockHandler = I810BlockHandler; + } + + return Success; +} + + +static void +I810InitOffscreenImages(ScreenPtr pScreen) +{ + XF86OffscreenImagePtr offscreenImages; + + /* need to free this someplace */ + if(!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) { + return; + } + + offscreenImages[0].image = &Images[0]; + offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES | + VIDEO_CLIP_TO_VIEWPORT; + offscreenImages[0].alloc_surface = I810AllocateSurface; + offscreenImages[0].free_surface = I810FreeSurface; + offscreenImages[0].display = I810DisplaySurface; + offscreenImages[0].stop = I810StopSurface; + offscreenImages[0].setAttribute = I810SetSurfaceAttribute; + offscreenImages[0].getAttribute = I810GetSurfaceAttribute; + offscreenImages[0].max_width = 1024; + offscreenImages[0].max_height = 1024; + offscreenImages[0].num_attributes = 1; + offscreenImages[0].attributes = Attributes; + + xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); +} + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h index 9a83c7c21..fd24a1a61 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.73 2001/04/05 17:42:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.74 2001/04/18 15:29:18 dawes Exp $ */ /* * MGA Millennium (MGA2064W) functions * @@ -196,6 +196,11 @@ typedef struct { #define MGAPTR(p) ((MGAPtr)((p)->driverPrivate)) +#define ISDIGITAL1(p) ((p->pMgaHwInfo->ulCapsFirstOutput) & MGAHWINFOCAPS_OUTPUT_DIGITAL) +#define ISDIGITAL2(p) ((p->pMgaHwInfo->ulCapsSecondOutput) & MGAHWINFOCAPS_OUTPUT_DIGITAL) +#define ISTV1(p) ((p->pMgaHwInfo->ulCapsFirstOutput) & MGAHWINFOCAPS_OUTPUT_TV) +#define ISTV2(p) ((p->pMgaHwInfo->ulCapsSecondOutput) & MGAHWINFOCAPS_OUTPUT_TV) + #ifdef DISABLE_VGA_IO typedef struct mgaSave { pciVideoPtr pvp; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c index eba6ecaf8..83154198f 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.19 2001/03/21 19:46:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.20 2001/04/10 16:08:00 dawes Exp $ */ /* * Copyright 2000 VA Linux Systems Inc., Fremont, California. @@ -120,20 +120,20 @@ static Bool MGAInitVisualConfigs( ScreenPtr pScreen ) case 16: numConfigs = 8; - pConfigs = (__GLXvisualConfig*)xnfcalloc( sizeof(__GLXvisualConfig), + pConfigs = (__GLXvisualConfig*)xcalloc( sizeof(__GLXvisualConfig), numConfigs ); if ( !pConfigs ) { return FALSE; } - pMGAConfigs = (MGAConfigPrivPtr)xnfcalloc( sizeof(MGAConfigPrivRec), + pMGAConfigs = (MGAConfigPrivPtr)xcalloc( sizeof(MGAConfigPrivRec), numConfigs ); if ( !pMGAConfigs ) { xfree( pConfigs ); return FALSE; } - pMGAConfigPtrs = (MGAConfigPrivPtr*)xnfcalloc( sizeof(MGAConfigPrivPtr), + pMGAConfigPtrs = (MGAConfigPrivPtr*)xcalloc( sizeof(MGAConfigPrivPtr), numConfigs ); if ( !pMGAConfigPtrs ) { xfree( pConfigs ); @@ -216,20 +216,20 @@ static Bool MGAInitVisualConfigs( ScreenPtr pScreen ) case 32: numConfigs = 8; - pConfigs = (__GLXvisualConfig*)xnfcalloc( sizeof(__GLXvisualConfig), + pConfigs = (__GLXvisualConfig*)xcalloc( sizeof(__GLXvisualConfig), numConfigs ); if ( !pConfigs ) { return FALSE; } - pMGAConfigs = (MGAConfigPrivPtr)xnfcalloc( sizeof(MGAConfigPrivRec), + pMGAConfigs = (MGAConfigPrivPtr)xcalloc( sizeof(MGAConfigPrivRec), numConfigs ); if ( !pMGAConfigs ) { xfree( pConfigs ); return FALSE; } - pMGAConfigPtrs = (MGAConfigPrivPtr*)xnfcalloc( sizeof(MGAConfigPrivPtr), + pMGAConfigPtrs = (MGAConfigPrivPtr*)xcalloc( sizeof(MGAConfigPrivPtr), numConfigs ); if ( !pMGAConfigPtrs ) { xfree( pConfigs ); @@ -943,14 +943,17 @@ Bool MGADRIScreenInit( ScreenPtr pScreen ) if ( (pScrn->bitsPerPixel / 8) != 2 && (pScrn->bitsPerPixel / 8) != 4 ) { - xf86DrvMsg( pScreen->myNum, X_INFO, + xf86DrvMsg( pScreen->myNum, X_ERROR, "[drm] Direct rendering only supported in 16 and 32 bpp modes\n" ); return FALSE; } pDRIInfo = DRICreateInfoRec(); - if ( !pDRIInfo ) + if ( !pDRIInfo ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[drm] DRICreateInfoRec() failed\n" ); return FALSE; + } pMga->pDRIInfo = pDRIInfo; pDRIInfo->drmDriverName = MGAKernelDriverName; @@ -998,7 +1001,7 @@ Bool MGADRIScreenInit( ScreenPtr pScreen ) pDRIInfo->SAREASize = SAREA_MAX; - pMGADRI = (MGADRIPtr)xnfcalloc( sizeof(MGADRIRec), 1 ); + pMGADRI = (MGADRIPtr)xcalloc( sizeof(MGADRIRec), 1 ); if ( !pMGADRI ) { DRIDestroyInfoRec( pMga->pDRIInfo ); pMga->pDRIInfo = 0; @@ -1008,7 +1011,7 @@ Bool MGADRIScreenInit( ScreenPtr pScreen ) } pMGADRIServer = (MGADRIServerPrivatePtr) - xnfcalloc( sizeof(MGADRIServerPrivateRec), 1 ); + xcalloc( sizeof(MGADRIServerPrivateRec), 1 ); if ( !pMGADRIServer ) { xfree( pMGADRI ); DRIDestroyInfoRec( pMga->pDRIInfo ); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h index 97588bff5..0ab62aa32 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h,v 1.5 2001/03/21 17:02:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h,v 1.6 2001/04/10 16:08:01 dawes Exp $ */ /* * Copyright 2000 VA Linux Systems Inc., Fremont, California. @@ -39,7 +39,7 @@ /* Buffer are aligned on 4096 byte boundaries. */ -#define MGA_BUFFER_ALIGN 0x00000fff +#define MGA_BUFFER_ALIGN 0x00000fff typedef struct { int reserved_map_agpstart; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h index ba645d2bd..3ddd133be 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h,v 1.3 2001/03/21 17:11:47 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h,v 1.4 2001/04/10 16:08:01 dawes Exp $ */ /* * Copyright 2000 VA Linux Systems Inc., Fremont, California. diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c index e9ea1b853..c1bf3ef23 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.195 2001/04/06 02:09:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.199 2001/04/27 05:14:04 keithp Exp $ */ /* * This is a first cut at a non-accelerated version to work with the @@ -129,6 +129,9 @@ static int MGAValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, static void MGADisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); +static void MGADisplayPowerManagementSetCrtc2(ScrnInfoPtr pScrn, + int PowerManagementMode, + int flags); /* Internally used functions */ static Bool MGAMapMem(ScrnInfoPtr pScrn); @@ -214,7 +217,8 @@ typedef enum { OPTION_CABLETYPE, OPTION_USEIRQZERO, OPTION_NOHAL, - OPTION_SWAPPED_HEAD + OPTION_SWAPPED_HEAD, + OPTION_DRI } MGAOpts; static OptionInfoRec MGAOptions[] = { @@ -243,7 +247,8 @@ static OptionInfoRec MGAOptions[] = { { OPTION_TVSTANDARD, "TVStandard", OPTV_ANYSTR, {0}, FALSE }, { OPTION_CABLETYPE, "CableType", OPTV_ANYSTR, {0}, FALSE }, { OPTION_NOHAL, "NoHal", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_SWAPPED_HEAD, "SwappedHead", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SWAPPED_HEAD, "SwappedHead", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -315,20 +320,28 @@ static const char *drmSymbols[] = { "drmAddMap", "drmCtlInstHandler", "drmGetInterruptFromBusID", + "drmFreeVersion", + "drmGetVersion", + "drmMap", + "drmUnmap", + "drmMapBufs", + "drmUnmapBufs", "drmAgpAcquire", "drmAgpRelease", "drmAgpEnable", "drmAgpAlloc", "drmAgpFree", "drmAgpBind", + "drmAgpUnbind", "drmAgpGetMode", "drmAgpBase", "drmAgpSize", + "drmAgpVendorId", + "drmAgpDeviceId", "drmMGAInitDMA", "drmMGACleanupDMA", "drmMGAFlushDMA", - "drmFreeVersion", - "drmGetVersion", + "drmMGAEngineReset", NULL }; @@ -967,9 +980,9 @@ MGACountRam(ScrnInfoPtr pScrn) base = pMga->FbBase; /* turn MGA mode on - enable linear frame buffer (CRTCEXT3) */ - OUTREG8(0x1FDE, 3); - tmp = INREG8(0x1FDF); - OUTREG8(0x1FDF, tmp | 0x80); + OUTREG8(MGAREG_CRTCEXT_INDEX, 3); + tmp = INREG8(MGAREG_CRTCEXT_DATA); + OUTREG8(MGAREG_CRTCEXT_DATA, tmp | 0x80); /* write, read and compare method */ for(i = ProbeSize; i > 2048; i -= 2048) { @@ -983,8 +996,8 @@ MGACountRam(ScrnInfoPtr pScrn) } /* restore CRTCEXT3 state */ - OUTREG8(0x1FDE, 3); - OUTREG8(0x1FDF, tmp); + OUTREG8(MGAREG_CRTCEXT_INDEX, 3); + OUTREG8(MGAREG_CRTCEXT_DATA, tmp); MGAUnmapMem(pScrn); } @@ -1153,8 +1166,10 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) MGAEntPtr pMgaEnt = NULL; #ifdef USEMGAHAL MGAMODEINFO mgaModeInfo = {0}; - Bool digital = FALSE; - Bool tv = FALSE; + Bool digital1 = FALSE; + Bool digital2 = FALSE; + Bool tv1 = FALSE; + Bool tv2 = FALSE; Bool swap_head = FALSE; ULONG status; #endif @@ -1313,13 +1328,17 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) * We support both 24bpp and 32bpp layouts, so indicate that. */ - /* Prefer 24bpp fb unless the Overlay option is set */ + /* Prefer 24bpp fb unless the Overlay option is set, or DRI is + * supported. + */ flags24 = Support24bppFb | Support32bppFb | SupportConvert32to24; s = xf86TokenToOptName(MGAOptions, OPTION_OVERLAY); +#ifndef XF86DRI if (!(xf86FindOption(pScrn->confScreen->options, s) || xf86FindOption(pMga->device->options, s))) { flags24 |= PreferConvert32to24; } +#endif if (pMga->SecondCrtc) flags24 = Support32bppFb; @@ -1472,18 +1491,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) if (xf86GetOptValBool(MGAOptions, OPTION_HW_CURSOR, &pMga->HWCursor)) { from = X_CONFIG; } -#ifdef USEMGAHAL - if (pMga->HALLoaded) { - xf86GetOptValBool(MGAOptions, OPTION_TV, &tv); - if (tv == TRUE) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Support\n"); - } - xf86GetOptValBool(MGAOptions, OPTION_DIGITAL, &digital); - if (digital == TRUE) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Digital Screen Support\n"); - } - } -#endif + /* For compatibility, accept this too (as an override) */ if (xf86ReturnOptValBool(MGAOptions, OPTION_NOACCEL, FALSE)) { pMga->NoAccel = TRUE; @@ -1767,8 +1775,9 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) xf86GetOptValBool(MGAOptions, OPTION_CRTC2HALF, &UseHalf); adjust = pScrn->videoRam / 2; - if (UseHalf == TRUE || xf86GetOptValInteger(MGAOptions, OPTION_CRTC2RAM, &adjust)) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + if (UseHalf == TRUE || + xf86GetOptValInteger(MGAOptions, OPTION_CRTC2RAM, &adjust)) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Crtc2 will use %dK of VideoRam\n", adjust); } else { @@ -2031,33 +2040,49 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) } #ifdef USEMGAHAL MGA_HAL( - swap_head + swap_head = xf86ReturnOptValBool(MGAOptions, OPTION_SWAPPED_HEAD, FALSE); if(pMga->SecondCrtc == FALSE) { - pMga->pBoard = (LPBOARDHANDLE) xalloc (sizeof(CLIENTDATA) + MGAGetBOARDHANDLESize()); - pMga->pClientStruct = (LPCLIENTDATA) xalloc (sizeof(CLIENTDATA)); + pMga->pBoard = xalloc(sizeof(CLIENTDATA) + MGAGetBOARDHANDLESize()); + pMga->pClientStruct = xalloc(sizeof(CLIENTDATA)); pMga->pClientStruct->pMga = (MGAPtr) pMga; MGAMapMem(pScrn); MGAOpenLibrary(pMga->pBoard,pMga->pClientStruct,sizeof(CLIENTDATA)); MGAUnmapMem(pScrn); - pMga->pMgaHwInfo = (LPMGAHWINFO) xalloc (sizeof(MGAHWINFO)); + pMga->pMgaHwInfo = xalloc(sizeof(MGAHWINFO)); MGAGetHardwareInfo(pMga->pBoard,pMga->pMgaHwInfo); - /* copy the board handles */ - if(xf86IsEntityShared(pScrn->entityList[0])) { - pMgaEnt->pClientStruct = pMga->pClientStruct; - pMgaEnt->pBoard = pMga->pBoard; - pMgaEnt->pMgaHwInfo = pMga->pMgaHwInfo; - } - - if (!swap_head) { - mgaModeInfo.flOutput = (digital == TRUE) ? MGAMODEINFO_DIGITAL2 - : MGAMODEINFO_ANALOG1; + digital1 = ISDIGITAL1(pMga); + digital2 = ISDIGITAL2(pMga); + tv1 = ISTV1(pMga); + tv2 = ISTV2(pMga); + + /* Display type information */ + if (digital1) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Digital screen detected on first head.\n"); + mgaModeInfo.flOutput = MGAMODEINFO_DIGITAL2; + } else if (tv1) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "TV detected on first head.\n"); + mgaModeInfo.flOutput = MGAMODEINFO_TV; } else { - mgaModeInfo.flOutput = MGAMODEINFO_ANALOG2; + if (!swap_head) { + mgaModeInfo.flOutput = MGAMODEINFO_ANALOG1; + } else { + mgaModeInfo.flOutput = MGAMODEINFO_ANALOG2; + } + } + + /* copy the board handles */ + if (xf86IsEntityShared(pScrn->entityList[0])) { + pMgaEnt->pClientStruct = pMga->pClientStruct; + pMgaEnt->pBoard = pMga->pBoard; + pMgaEnt->pMgaHwInfo = pMga->pMgaHwInfo; } + mgaModeInfo.ulDispWidth = pScrn->virtualX; mgaModeInfo.ulDispHeight = pScrn->virtualY; mgaModeInfo.ulDeskWidth = pScrn->virtualX; @@ -2065,10 +2090,10 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) mgaModeInfo.ulBpp = pScrn->bitsPerPixel; mgaModeInfo.ulZoom = 1; } else { /* Second CRTC && entity is shared */ - if (digital == TRUE) { + if (digital2 == TRUE) { mgaModeInfo.flOutput = MGAMODEINFO_DIGITAL2 | MGAMODEINFO_SECOND_CRTC; - } else if (tv == TRUE) { + } else if (tv2 == TRUE) { mgaModeInfo.flOutput = MGAMODEINFO_TV | MGAMODEINFO_SECOND_CRTC; } else { @@ -2088,18 +2113,40 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) mgaModeInfo.ulZoom = 1; pMga->pBoard = pMgaEnt->pBoard; pMga->pClientStruct = pMgaEnt->pClientStruct; - pMga->pMgaHwInfo = pMga->pMgaHwInfo; + pMga->pMgaHwInfo = pMgaEnt->pMgaHwInfo; + + digital1 = ISDIGITAL1(pMga); + digital2 = ISDIGITAL2(pMga); + tv1 = ISTV1(pMga); + tv2 = ISTV2(pMga); + + if (digital2) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Digital screen detected on second head.\n"); + mgaModeInfo.flOutput = MGAMODEINFO_DIGITAL2 | + MGAMODEINFO_SECOND_CRTC; + } else if (tv2) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "TV detected on second head.\n"); + mgaModeInfo.flOutput = MGAMODEINFO_TV | + MGAMODEINFO_SECOND_CRTC; + } else { + mgaModeInfo.flOutput = MGAMODEINFO_ANALOG2 | + MGAMODEINFO_SECOND_CRTC; + } } + if((status = MGAValidateMode(pMga->pBoard,&mgaModeInfo)) != 0) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "MGAValidateMode from HALlib found the mode to be invalid: 0x%lx\n", status); + "MGAValidateMode from HALlib found the mode to be invalid.\n" + "\tError: 0x%lx\n", status); return FALSE; } pScrn->displayWidth = mgaModeInfo.ulFBPitch; ); /* MGA_HAL */ #endif - if(pMga->HasSDRAM) { /* don't bother checking */ } + if (pMga->HasSDRAM) { /* don't bother checking */ } else if ((pMga->PciInfo->subsysCard == PCI_CARD_MILL_G200_SD) || (pMga->PciInfo->subsysCard == PCI_CARD_MARV_G200_SD) || (pMga->PciInfo->subsysCard == PCI_CARD_MYST_G200_SD) || @@ -2111,10 +2158,10 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) * Can we trust HALlib to set the memory configuration * registers correctly? */ - else if ((pMga->softbooted || pMga->Primary /*|| pMga->HALLoaded*/ ) && - (pMga->Chipset != PCI_CHIP_MGA2064) && + else if ((pMga->softbooted || pMga->Primary /*|| pMga->HALLoaded*/ ) && + (pMga->Chipset != PCI_CHIP_MGA2064) && (pMga->Chipset != PCI_CHIP_MGA2164) && - (pMga->Chipset != PCI_CHIP_MGA2164_AGP)) { + (pMga->Chipset != PCI_CHIP_MGA2164_AGP)) { CARD32 option_reg = pciReadLong(pMga->PciTag, PCI_OPTION_REG); if(!(option_reg & (1 << 14))) { pMga->HasSDRAM = TRUE; @@ -2498,7 +2545,7 @@ static void FillModeInfoStruct(ScrnInfoPtr pScrn, DisplayModePtr mode) const char *s; MGAPtr pMga = MGAPTR(pScrn); - pMga->pMgaModeInfo = (LPMGAMODEINFO) xalloc (sizeof(MGAMODEINFO)); + pMga->pMgaModeInfo = xalloc(sizeof(MGAMODEINFO)); pMga->pMgaModeInfo->flOutput = 0; pMga->pMgaModeInfo->ulDispWidth = mode->HDisplay; pMga->pMgaModeInfo->ulDispHeight = mode->VDisplay; @@ -2520,7 +2567,7 @@ static void FillModeInfoStruct(ScrnInfoPtr pScrn, DisplayModePtr mode) pMga->pMgaModeInfo->ulTVStandard = TV_NTSC; } } else { - pMga->pMgaModeInfo->ulRefreshRate = 60; + pMga->pMgaModeInfo->ulRefreshRate = 0; pMga->pMgaModeInfo->ulTVStandard = TV_NTSC; } @@ -2570,16 +2617,21 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) MGAPtr pMga = MGAPTR(pScrn); MGARegPtr mgaReg; #ifdef USEMGAHAL - Bool digital = FALSE; - Bool tv = FALSE; + Bool digital1 = FALSE; + Bool digital2 = FALSE; + Bool tv1 = FALSE; + Bool tv2 = FALSE; ULONG status; - Bool swap_head + Bool swap_head = xf86ReturnOptValBool(MGAOptions, OPTION_SWAPPED_HEAD, FALSE); - /* Verify if user wants digital screen output */ - xf86GetOptValBool(MGAOptions, OPTION_DIGITAL, &digital); - /* Verify if user wants TV output */ - xf86GetOptValBool(MGAOptions, OPTION_TV, &tv); + if (pMga->pMgaHwInfo) + { + digital1 = ISDIGITAL1(pMga); + digital2 = ISDIGITAL2(pMga); + tv1 = ISTV1(pMga); + tv2 = ISTV2(pMga); + } #endif vgaHWUnlock(hwp); @@ -2602,50 +2654,51 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) FillModeInfoStruct(pScrn,mode); if(pMga->SecondCrtc == TRUE) { - if (digital == TRUE) { - pMga->pMgaModeInfo->flOutput = MGAMODEINFO_DIGITAL2 | - MGAMODEINFO_SECOND_CRTC | - MGAMODEINFO_FORCE_PITCH | - MGAMODEINFO_FORCE_DISPLAYORG; - } else if (tv == TRUE) { - pMga->pMgaModeInfo->flOutput = MGAMODEINFO_TV | - MGAMODEINFO_SECOND_CRTC | - MGAMODEINFO_FORCE_PITCH | - MGAMODEINFO_FORCE_DISPLAYORG; + pMga->pMgaModeInfo->flOutput = MGAMODEINFO_SECOND_CRTC | + MGAMODEINFO_FORCE_PITCH | + MGAMODEINFO_FORCE_DISPLAYORG; + if (digital2) { + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_DIGITAL2; + } else if (tv2) { + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_TV; } else { if (!swap_head) { - pMga->pMgaModeInfo->flOutput = MGAMODEINFO_ANALOG2 | - MGAMODEINFO_SECOND_CRTC | - MGAMODEINFO_FORCE_PITCH | - MGAMODEINFO_FORCE_DISPLAYORG; + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_ANALOG2; } else { - pMga->pMgaModeInfo->flOutput = MGAMODEINFO_ANALOG1 | - MGAMODEINFO_SECOND_CRTC | - MGAMODEINFO_FORCE_PITCH | - MGAMODEINFO_FORCE_DISPLAYORG; + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_ANALOG1; } } } else { - if (!swap_head) { - pMga->pMgaModeInfo->flOutput = - ((digital == TRUE) ? MGAMODEINFO_DIGITAL2 : MGAMODEINFO_ANALOG1) | - MGAMODEINFO_FORCE_PITCH; - } else { - pMga->pMgaModeInfo->flOutput = MGAMODEINFO_ANALOG2 | - MGAMODEINFO_FORCE_PITCH; + pMga->pMgaModeInfo->flOutput = MGAMODEINFO_FORCE_PITCH; + if (digital1) { + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_DIGITAL2; + } else if (tv1) { + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_TV; + } else { + if (!swap_head) { + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_ANALOG1; + } else { + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_ANALOG2; + } } } pMga->pMgaModeInfo->ulFBPitch = pScrn->displayWidth; + /* Validate the parameters */ if ((status = MGAValidateMode(pMga->pBoard, pMga->pMgaModeInfo)) != 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "MGAValidateMode from HALlib found the mode to be invalid. Error: %lx\n", status); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "MGAValidateMode from HALlib found the mode to be invalid.\n" + "\tError: %lx\n", status); return FALSE; } /* Validates the Video parameters */ - if ((status = MGAValidateVideoParameters(pMga->pBoard, pMga->pMgaModeInfo)) != 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "MGAValidateVideoParameters from HALlib found the mode to be invalid. Error: %lx\n", status); + if ((status = MGAValidateVideoParameters(pMga->pBoard, pMga->pMgaModeInfo)) + != 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "MGAValidateVideoParameters from HALlib found the mode to be" + " invalid.\n\tError: %lx\n", status); return FALSE; } ); /* MGA_HAL */ @@ -2662,7 +2715,8 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) /* Initialize the board */ if(MGASetMode(pMga->pBoard,pMga->pMgaModeInfo) != 0) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "MGASetMode returned an error. Make sure to validate the mode before.\n"); + "MGASetMode returned an error." + " Make sure to validate the mode before.\n"); return FALSE; } ); /* MGA_HAL */ @@ -2771,6 +2825,7 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) int width, height, displayWidth; MGAEntPtr pMgaEnt = NULL; int f; + MessageType driFrom = X_DEFAULT; /* * First get the ScrnInfoRec @@ -2790,8 +2845,8 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) return FALSE; } - if ((pMga->Chipset == PCI_CHIP_MGAG100) - || (pMga->Chipset == PCI_CHIP_MGAG100_PCI)) + if ((pMga->Chipset == PCI_CHIP_MGAG100) + || (pMga->Chipset == PCI_CHIP_MGAG100_PCI)) MGAG100BlackMagic(pMga); if (xf86IsEntityShared(pScrn->entityList[0])) { @@ -2802,23 +2857,27 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) #ifdef USEMGAHAL MGA_HAL( if(pMgaEnt->refCount == 1) { - pMga->pBoard = (LPBOARDHANDLE) xalloc (sizeof(CLIENTDATA) + MGAGetBOARDHANDLESize()); - pMga->pClientStruct = (LPCLIENTDATA) xalloc (sizeof(CLIENTDATA)); + pMga->pBoard = xalloc(sizeof(CLIENTDATA) + MGAGetBOARDHANDLESize()); + pMga->pClientStruct = xalloc(sizeof(CLIENTDATA)); pMga->pClientStruct->pMga = (MGAPtr) pMga; MGAOpenLibrary(pMga->pBoard,pMga->pClientStruct,sizeof(CLIENTDATA)); - pMga->pMgaHwInfo = (LPMGAHWINFO) xalloc (sizeof(MGAHWINFO)); + pMga->pMgaHwInfo = xalloc(sizeof(MGAHWINFO)); MGAGetHardwareInfo(pMga->pBoard,pMga->pMgaHwInfo); /* Detecting for type of display */ if (pMga->pMgaHwInfo->ulCapsSecondOutput & MGAHWINFOCAPS_OUTPUT_TV) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "TV detected\n"); } - if (pMga->pMgaHwInfo->ulCapsFirstOutput & MGAHWINFOCAPS_OUTPUT_DIGITAL) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Digital Screen detected\n"); + if (pMga->pMgaHwInfo->ulCapsFirstOutput & + MGAHWINFOCAPS_OUTPUT_DIGITAL) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Digital Screen detected\n"); } - if (pMga->pMgaHwInfo->ulCapsSecondOutput & MGAHWINFOCAPS_OUTPUT_DIGITAL) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Digital Screen detected\n"); + if (pMga->pMgaHwInfo->ulCapsSecondOutput & + MGAHWINFOCAPS_OUTPUT_DIGITAL) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Digital Screen detected\n"); } /* Now copy these to the entitystructure */ @@ -2835,12 +2894,12 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } else { #ifdef USEMGAHAL MGA_HAL( - pMga->pBoard = (LPBOARDHANDLE) xalloc (sizeof(CLIENTDATA) + MGAGetBOARDHANDLESize()); - pMga->pClientStruct = (LPCLIENTDATA) xalloc (sizeof(CLIENTDATA)); + pMga->pBoard = xalloc(sizeof(CLIENTDATA) + MGAGetBOARDHANDLESize()); + pMga->pClientStruct = xalloc(sizeof(CLIENTDATA)); pMga->pClientStruct->pMga = (MGAPtr) pMga; MGAOpenLibrary(pMga->pBoard,pMga->pClientStruct,sizeof(CLIENTDATA)); - pMga->pMgaHwInfo = (LPMGAHWINFO) xalloc (sizeof(MGAHWINFO)); + pMga->pMgaHwInfo = xalloc(sizeof(MGAHWINFO)); MGAGetHardwareInfo(pMga->pBoard,pMga->pMgaHwInfo); ); /* MGA_HAL */ #endif @@ -2848,7 +2907,7 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) #ifdef USEMGAHAL MGA_HAL( /* There is a problem in the HALlib: set soft reset bit */ - if (!pMga->Primary && !pMga->FBDev && + if (!pMga->Primary && !pMga->FBDev && (pMga->PciInfo->subsysCard == PCI_CARD_MILL_G200_SG) ) { OUTREG(MGAREG_Reset, 1); usleep(200); @@ -2969,12 +3028,38 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) * InitGLXVisuals call back. * The DRI does not work when textured video is enabled at this time. */ - - if (!pMga->NoAccel && pMga->TexturedVideo != TRUE && - pMga->SecondCrtc == FALSE) - pMga->directRenderingEnabled = MGADRIScreenInit(pScreen); - else + if (!xf86ReturnOptValBool(MGAOptions, OPTION_DRI, TRUE)) { + driFrom = X_CONFIG; + } else if ( pMga->NoAccel ) { + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "Acceleration disabled, not initializing the DRI\n" ); pMga->directRenderingEnabled = FALSE; + driFrom = X_CONFIG; + } + else if ( pMga->TexturedVideo == TRUE ) { + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "Textured video enabled, not initializing the DRI\n" ); + pMga->directRenderingEnabled = FALSE; + driFrom = X_CONFIG; + } + else if (pMga->SecondCrtc == TRUE) { + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "Not initializing the DRI on the second head\n" ); + pMga->directRenderingEnabled = FALSE; + } + else if ((pMga->FbMapSize / + (width * (pScrn->bitsPerPixel >> 3))) <= height * 3) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Static buffer allocation failed, not initializing the DRI\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Need at least %d kB video memory at this resolution, bit depth\n", + (3 * displayWidth * height * (pScrn->bitsPerPixel >> 3)) / 1024 ); + pMga->directRenderingEnabled = FALSE; + driFrom = X_PROBED; + } + else { + pMga->directRenderingEnabled = MGADRIScreenInit(pScreen); + } #endif @@ -3076,8 +3161,12 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) ShadowFBInit(pScreen, refreshArea); } - xf86DPMSInit(pScreen, MGADisplayPowerManagementSet, 0); - + if(pMga->SecondCrtc == TRUE) { + xf86DPMSInit(pScreen, MGADisplayPowerManagementSetCrtc2, 0); + } else { + xf86DPMSInit(pScreen, MGADisplayPowerManagementSet, 0); + } + pScrn->memPhysBase = pMga->FbAddress; pScrn->fbOffset = pMga->YDstOrg * (pScrn->bitsPerPixel / 8); @@ -3096,9 +3185,9 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pMga->directRenderingEnabled = MGADRIFinishScreenInit(pScreen); } if (pMga->directRenderingEnabled) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering enabled\n"); + xf86DrvMsg(pScrn->scrnIndex, driFrom, "Direct rendering enabled\n"); } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering disabled\n"); + xf86DrvMsg(pScrn->scrnIndex, driFrom, "Direct rendering disabled\n"); } if (xf86IsEntityShared(pScrn->entityList[0]) && pMga->SecondCrtc == FALSE) pMgaEnt->directRenderingEnabled = pMga->directRenderingEnabled; @@ -3464,39 +3553,19 @@ MGAValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) } -/* Do screen blanking */ - -/* Mandatory */ -#define MGAREG_C2CTL 0x3c10 - +/* + * This routine is required but since we can't easily blank the + * second display without risking powering off the monitor, return + * FALSE and let the X server do something generic. + */ static Bool MGASaveScreenCrtc2(ScreenPtr pScreen, int mode) { - ScrnInfoPtr pScrn = NULL; - MGAPtr pMga = NULL; - Bool on; - CARD32 tmp; - - on = xf86IsUnblank(mode); - - if (on) - SetTimeSinceLastInputEvent(); - if (pScreen != NULL) - pScrn = xf86Screens[pScreen->myNum]; - - if (pScrn != NULL) - pMga = MGAPTR(pScrn); - - if(pMga != NULL && pScrn->vtSema) { - tmp = INREG(MGAREG_C2CTL); - tmp &= ~0x00000008; - if (!on) tmp |= 0x0000008; - OUTREG(MGAREG_C2CTL, tmp); - } - - return TRUE; + return FALSE; } +/* Do screen blanking */ + static Bool MGASaveScreen(ScreenPtr pScreen, int mode) { @@ -3540,12 +3609,26 @@ MGADisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, break; } /* XXX Prefer an implementation that doesn't depend on VGA specifics */ - OUTREG8(0x1FC4, 0x01); /* Select SEQ1 */ - seq1 |= INREG8(0x1FC5) & ~0x20; - OUTREG8(0x1FC5, seq1); - OUTREG8(0x1FDE, 0x01); /* Select CRTCEXT1 */ - crtcext1 |= INREG8(0x1FDF) & ~0x30; - OUTREG8(0x1FDF, crtcext1); + OUTREG8(MGAREG_SEQ_INDEX, 0x01); /* Select SEQ1 */ + seq1 |= INREG8(MGAREG_SEQ_DATA) & ~0x20; + OUTREG8(MGAREG_SEQ_DATA, seq1); + OUTREG8(MGAREG_CRTCEXT_INDEX, 0x01); /* Select CRTCEXT1 */ + crtcext1 |= INREG8(MGAREG_CRTCEXT_DATA) & ~0x30; + OUTREG8(MGAREG_CRTCEXT_DATA, crtcext1); +} + + +static void +MGADisplayPowerManagementSetCrtc2(ScrnInfoPtr pScrn, int PowerManagementMode, + int flags) +{ + MGAPtr pMga = MGAPTR(pScrn); + CARD32 crtc2 = 0; + + if (PowerManagementMode != DPMSModeOn) + crtc2 = 0x8; /* c2pixclkdis */ + crtc2 |= INREG(MGAREG_C2CTL) & ~0x8; + OUTREG(MGAREG_C2CTL, crtc2); } @@ -3590,7 +3673,8 @@ dbg_inreg8(ScrnInfoPtr pScrn,int addr,int verbose) pMga = MGAPTR(pScrn); ret = *(volatile CARD8 *)(pMga->IOBase + (addr)); if(verbose) - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "inreg8 : 0x%8x = 0x%x\n",addr,ret); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "inreg8 : 0x%8x = 0x%x\n",addr,ret); return ret; } @@ -3603,7 +3687,8 @@ dbg_inreg16(ScrnInfoPtr pScrn,int addr,int verbose) pMga = MGAPTR(pScrn); ret = *(volatile CARD16 *)(pMga->IOBase + (addr)); if(verbose) - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "inreg16: 0x%8x = 0x%x\n",addr,ret); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "inreg16: 0x%8x = 0x%x\n",addr,ret); return ret; } @@ -3616,7 +3701,8 @@ dbg_inreg32(ScrnInfoPtr pScrn,int addr,int verbose) pMga = MGAPTR(pScrn); ret = *(volatile CARD32 *)(pMga->IOBase + (addr)); if(verbose) - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "inreg32: 0x%8x = 0x%x\n",addr,ret); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "inreg32: 0x%8x = 0x%x\n",addr,ret); return ret; } @@ -3628,12 +3714,13 @@ dbg_outreg8(ScrnInfoPtr pScrn,int addr,int val) pMga = MGAPTR(pScrn); #if 0 - if( addr = 0x1fdf ) + if( addr = MGAREG_CRTCEXT_DATA ) return; #endif if( addr != 0x3c00 ) { ret = dbg_inreg8(pScrn,addr,0); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "outreg8 : 0x%8x = 0x%x was 0x%x\n",addr,val,ret); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "outreg8 : 0x%8x = 0x%x was 0x%x\n",addr,val,ret); } else { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "outreg8 : index 0x%x\n",val); @@ -3648,12 +3735,13 @@ dbg_outreg16(ScrnInfoPtr pScrn,int addr,int val) CARD16 ret; #if 0 - if (addr == 0x1fde) + if (addr == MGAREG_CRTCEXT_INDEX) return; #endif pMga = MGAPTR(pScrn); ret = dbg_inreg16(pScrn,addr,0); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "outreg16 : 0x%8x = 0x%x was 0x%x\n",addr,val,ret); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "outreg16 : 0x%8x = 0x%x was 0x%x\n",addr,val,ret); *(volatile CARD16 *)(pMga->IOBase + (addr)) = (val); } @@ -3679,7 +3767,8 @@ dbg_outreg32(ScrnInfoPtr pScrn,int addr,int val) } pMga = MGAPTR(pScrn); ret = dbg_inreg32(pScrn,addr,0); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "outreg32 : 0x%8x = 0x%x was 0x%x\n",addr,val,ret); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "outreg32 : 0x%8x = 0x%x was 0x%x\n",addr,val,ret); *(volatile CARD32 *)(pMga->IOBase + (addr)) = (val); } #endif /* DEBUG */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h index c0689c334..7b2dcb9dc 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h @@ -2,7 +2,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h,v 1.16 2001/04/05 17:42:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h,v 1.17 2001/04/25 14:23:00 dawes Exp $ */ @@ -221,12 +221,15 @@ #define MGAREG_MISC_HIGH_PG_SEL (0x1 << 5) /* MMIO VGA registers */ +#define MGAREG_SEQ_INDEX 0x1fc4 +#define MGAREG_SEQ_DATA 0x1fc5 #define MGAREG_CRTC_INDEX 0x1fd4 #define MGAREG_CRTC_DATA 0x1fd5 #define MGAREG_CRTCEXT_INDEX 0x1fde #define MGAREG_CRTCEXT_DATA 0x1fdf + /* MGA bits for registers PCI_OPTION_REG */ #define MGA1064_OPT_SYS_CLK_PCI ( 0x00 << 0 ) #define MGA1064_OPT_SYS_CLK_PLL ( 0x01 << 0 ) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c index 4b8b34158..c1aca3dd7 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.87 2001/04/05 21:29:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.88 2001/04/10 16:08:01 dawes Exp $ */ /* All drivers should typically include these */ @@ -818,13 +818,13 @@ MGANAME(AccelInit)(ScreenPtr pScreen) MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo; BoxRec MemBox; int cpp = pScrn->bitsPerPixel / 8; - int width_bytes = pScrn->displayWidth * cpp; - int bufferSize = ((pScrn->virtualY * width_bytes + MGA_BUFFER_ALIGN) + int widthBytes = pScrn->displayWidth * cpp; + int bufferSize = ((pScrn->virtualY * widthBytes + MGA_BUFFER_ALIGN) & ~MGA_BUFFER_ALIGN); int scanlines; pMGADRIServer->frontOffset = 0; - pMGADRIServer->frontPitch = width_bytes; + pMGADRIServer->frontPitch = widthBytes; /* Try for front, back, depth, and two framebuffers worth of * pixmap cache. Should be enough for a fullscreen background @@ -844,10 +844,10 @@ MGANAME(AccelInit)(ScreenPtr pScreen) /* Check to see if there is more room available after the maximum * scanline for textures. */ - if ( (int)pMga->FbMapSize - maxlines * width_bytes - bufferSize * 2 + if ( (int)pMga->FbMapSize - maxlines * widthBytes - bufferSize * 2 > pMGADRIServer->textureSize ) { pMGADRIServer->textureSize = (pMga->FbMapSize - - maxlines * width_bytes - + maxlines * widthBytes - bufferSize * 2); } @@ -868,14 +868,14 @@ MGANAME(AccelInit)(ScreenPtr pScreen) pMGADRIServer->depthOffset = (pMGADRIServer->textureOffset - bufferSize + MGA_BUFFER_ALIGN) & ~MGA_BUFFER_ALIGN; - pMGADRIServer->depthPitch = width_bytes; + pMGADRIServer->depthPitch = widthBytes; /* Reserve space for the shared back buffer */ pMGADRIServer->backOffset = (pMGADRIServer->depthOffset - bufferSize + MGA_BUFFER_ALIGN) & ~MGA_BUFFER_ALIGN; - pMGADRIServer->backPitch = width_bytes; + pMGADRIServer->backPitch = widthBytes; - scanlines = pMGADRIServer->backOffset / width_bytes - 1; + scanlines = pMGADRIServer->backOffset / widthBytes - 1; if ( scanlines > maxlines ) scanlines = maxlines; MemBox.x1 = 0; @@ -1137,7 +1137,7 @@ MGAStormEngineInit(ScrnInfoPtr pScrn) pMga->PlaneMask = ~0; /* looks like this doesn't apply to mga g100 pci */ - if ((pMga->Chipset != PCI_CHIP_MGAG100) + if ((pMga->Chipset != PCI_CHIP_MGAG100) && (pMga->Chipset != PCI_CHIP_MGAG100_PCI)) OUTREG(MGAREG_PLNWT, pMga->PlaneMask); 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 536c6b55d..2728fdf82 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.23 2001/04/05 17:42:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.24 2001/04/25 14:23:00 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -677,7 +677,7 @@ MGADisplayVideoOverlay( short drw_w, short drw_h ){ MGAPtr pMga = MGAPTR(pScrn); - int tmp; + int tmp, hzoom, intrep; CHECK_DMA_QUIESCENT(pMga, pScrn); @@ -686,13 +686,18 @@ MGADisplayVideoOverlay( if(tmp > pScrn->currentMode->VDisplay) tmp -= pScrn->currentMode->VDisplay; + /* enable accelerated 2x horizontal zoom when pixelclock >135MHz */ + hzoom = (pScrn->currentMode->Clock > 135000) ? 1 : 0; + intrep = (((drw_w >= src_w) && !hzoom) || (drw_w == src_w) || + (drw_w < 2)) ? 0 : 1; + switch(id) { case FOURCC_UYVY: - OUTREG(MGAREG_BESGLOBCTL, 0x000000c3 | (tmp << 16)); + OUTREG(MGAREG_BESGLOBCTL, 0x000000c0 | (3 * hzoom) | (tmp << 16)); break; case FOURCC_YUY2: default: - OUTREG(MGAREG_BESGLOBCTL, 0x00000083 | (tmp << 16)); + OUTREG(MGAREG_BESGLOBCTL, 0x00000080 | (3 * hzoom) | (tmp << 16)); break; } @@ -720,7 +725,7 @@ MGADisplayVideoOverlay( tmp = (32 << 16) - 1; OUTREG(MGAREG_BESVISCAL, tmp & 0x001ffffc); - tmp = (((src_w - 1) << 16)/drw_w) << 1; + tmp = (((src_w - intrep) << 16)/(drw_w - intrep)) << hzoom; if(tmp >= (32 << 16)) tmp = (32 << 16) - 1; OUTREG(MGAREG_BESHISCAL, tmp & 0x001ffffc); 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 0d6e8723f..37776b1cc 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.6 2001/03/03 22:26:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.8 2001/04/19 14:09:36 tsi Exp $ */ /* * @@ -24,9 +24,6 @@ #include "savage_regs.h" #include "savage_bci.h" - -static unsigned int dwBCIWait2DIdle; - /* Forward declaration of functions used in the driver */ static void SavageSetupForScreenToScreenCopy( @@ -234,39 +231,85 @@ SavageInitialize2DEngine(ScrnInfoPtr pScrn) OUTREG16(0x8134, 0x27); OUTREG16(0x8136, 0x07); + if( psav->ShadowStatus && !psav->ShadowPhysical ) + { + psav->ShadowPhysical = + psav->FrameBufferBase + psav->CursorKByte*1024 + 4096 - 32; + + psav->ShadowVirtual = (unsigned long*) + (psav->FBBase + psav->CursorKByte*1024 + 4096 - 32); + + xf86DrvMsg( pScrn->scrnIndex, X_PROBED, + "Shadow area physical %08x, linear %08x\n", + psav->ShadowPhysical, psav->ShadowVirtual ); + } + switch( psav->Chipset ) { case S3_SAVAGE3D: case S3_SAVAGE_MX: /* Disable BCI */ OUTREG(0x48C18, INREG(0x48C18) & 0x3FF0); - /* Disable shadow status update */ - OUTREG(0x48C0C, 0); /* Setup BCI command overflow buffer */ OUTREG(0x48C14, (psav->cobOffset >> 11) | (psav->cobIndex << 29)); - /* Enable BCI and command overflow buffer */ - OUTREG(0x48C18, INREG(0x48C18) | 0x0C); + /* Program shadow status update. */ + OUTREG(0x48C10, 0x78207220); + if( psav->ShadowStatus ) + { + OUTREG(0x48C0C, psav->ShadowPhysical | 1 ); + /* Enable BCI and command overflow buffer */ + OUTREG(0x48C18, INREG(0x48C18) | 0x0E); + } + else + { + OUTREG(0x48C0C, 0); + /* Enable BCI and command overflow buffer */ + OUTREG(0x48C18, INREG(0x48C18) | 0x0C); + } break; case S3_SAVAGE4: case S3_PROSAVAGE: /* Disable BCI */ OUTREG(0x48C18, INREG(0x48C18) & 0x3FF0); - /* Disable shadow status update */ - OUTREG(0x48C0C, 0); - /* Enable BCI without the COB */ - OUTREG(0x48C18, INREG(0x48C18) | 0x08); + /* Program shadow status update */ + OUTREG(0x48C10, 0x00700040); + if( psav->ShadowStatus ) + { + OUTREG(0x48C0C, psav->ShadowPhysical | 1 ); + /* Enable BCI without the COB */ + OUTREG(0x48C18, INREG(0x48C18) | 0x0a); + } + else + { + OUTREG(0x48C0C, 0); + /* Enable BCI without the COB */ + OUTREG(0x48C18, INREG(0x48C18) | 0x08); + } break; case S3_SAVAGE2000: /* Disable BCI */ OUTREG(0x48C18, 0); - /* Disable shadow status update */ - OUTREG(0x48A30, 0); /* Setup BCI command overflow buffer */ OUTREG(0x48C18, (psav->cobOffset >> 7) | (psav->cobIndex)); - /* Enable BCI and command overflow buffer */ - OUTREG(0x48C18, INREG(0x48C18) | 0x00280000 ); + if( psav->ShadowStatus ) + { + /* Set shadow update threshholds. */ + OUTREG(0x48C10, 0x6090 ); + OUTREG(0x48C14, 0x70A8 ); + /* Enable shadow status update */ + OUTREG(0x48A30, psav->ShadowPhysical ); + /* Enable BCI, command overflow buffer and shadow status. */ + OUTREG(0x48C18, INREG(0x48C18) | 0x00380000 ); + } + else + { + /* Disable shadow status update */ + OUTREG(0x48A30, 0); + /* Enable BCI and command overflow buffer */ + OUTREG(0x48C18, INREG(0x48C18) | 0x00280000 ); + } break; } @@ -278,19 +321,7 @@ SavageInitialize2DEngine(ScrnInfoPtr pScrn) /* stride. Writing the register later, after the mode switch, works */ /* correctly. This needs to get resolved. */ - psav->SavedGbd = 1 | 8 | BCI_BD_BW_DISABLE; - BCI_BD_SET_BPP(psav->SavedGbd, pScrn->bitsPerPixel); - BCI_BD_SET_STRIDE(psav->SavedGbd, pScrn->displayWidth); - SavageSetGBD(pScrn); - - if( psav->StatusHack ) - { - if( psav->Chipset == S3_SAVAGE2000 ) - dwBCIWait2DIdle = 0xc0040000; - else - dwBCIWait2DIdle = 0xc0020000; - } } @@ -301,13 +332,11 @@ SavageSetGBD( ScrnInfoPtr pScrn ) SavagePtr psav = SAVPTR(pScrn); unsigned int vgaCRIndex = hwp->IOBase + 4; unsigned int vgaCRReg = hwp->IOBase + 5; + unsigned long GlobalBitmapDescriptor; - if( !psav->SavedGbd ) - { - psav->SavedGbd = 1 | 8 | BCI_BD_BW_DISABLE; - BCI_BD_SET_BPP(psav->SavedGbd, pScrn->bitsPerPixel); - BCI_BD_SET_STRIDE(psav->SavedGbd, pScrn->displayWidth); - } + GlobalBitmapDescriptor = 1 | 8 | BCI_BD_BW_DISABLE; + BCI_BD_SET_BPP(GlobalBitmapDescriptor, pScrn->bitsPerPixel); + BCI_BD_SET_STRIDE(GlobalBitmapDescriptor, pScrn->displayWidth); /* Turn on 16-bit register access. */ @@ -325,12 +354,12 @@ SavageSetGBD( ScrnInfoPtr pScrn ) /* Now set the GBD and SBDs. */ - OUTREG(0x8168,0); - OUTREG(0x816C,psav->SavedGbd); - OUTREG(0x8170,0); - OUTREG(0x8174,psav->SavedGbd); - OUTREG(0x8178,0); - OUTREG(0x817C,psav->SavedGbd); + OUTREG(0x8168, 0); + OUTREG(0x816C, GlobalBitmapDescriptor); + OUTREG(0x8170, 0); + OUTREG(0x8174, GlobalBitmapDescriptor); + OUTREG(0x8178, 0); + OUTREG(0x817C, GlobalBitmapDescriptor); OUTREG(PRI_STREAM_STRIDE, pScrn->displayWidth * pScrn->bitsPerPixel >> 3); OUTREG(SEC_STREAM_STRIDE, pScrn->displayWidth * pScrn->bitsPerPixel >> 3); @@ -417,6 +446,8 @@ SavageInitAccel(ScreenPtr pScreen) | HARDWARE_PATTERN_SCREEN_ORIGIN | BIT_ORDER_IN_BYTE_LSBFIRST ; + if( psav->Chipset == S3_SAVAGE4 ) + xaaptr->Mono8x8PatternFillFlags |= NO_TRANSPARENCY; #endif /* Color 8x8 pattern fills */ @@ -487,6 +518,10 @@ SavageInitAccel(ScreenPtr pScreen) | BIT_ORDER_IN_BYTE_MSBFIRST | LEFT_EDGE_CLIPPING ; + + if( psav->Chipset == S3_SAVAGE4 ) + xaaptr->ScanlineCPUToScreenColorExpandFillFlags |= ROP_NEEDS_SOURCE; + xaaptr->SetupForScanlineCPUToScreenColorExpandFill = SavageSetupForCPUToScreenColorExpandFill; xaaptr->SubsequentScanlineCPUToScreenColorExpandFill = @@ -532,44 +567,9 @@ void SavageAccelSync(ScrnInfoPtr pScrn) { SavagePtr psav = SAVPTR(pScrn); - - if( psav->StatusHack ) - { - static int counter = 0; - int i; - - /* - * This is an attempt to work around the status register read hang - * that affects about 4% of all Savage chips. Instead of reading - * the register through MMIO, we send a BCI command to wait for - * engine idle (which does not hang), then another BCI command to - * set an incrementing value into an innocuous register (the - * Cr Base register used in YUV page flipping). Then we loop - * waiting for the MMIO value of that register to change. - */ - - BCI_GET_PTR; - BCI_SEND(dwBCIWait2DIdle); /* wait for 2D idle */ - BCI_SEND(0x96010045); /* update New Cr Base Address ... */ - counter++; - BCI_SEND(counter); /* ... to this value */ - for( - i = 0; - (INREG(0x48914) != counter) && (i < 100000); - i++ - ) - ; - } - else - { - if( psav->StatusDelay ) - usleep( psav->StatusDelay ); - WaitIdleEmpty(); - } + psav->WaitIdleEmpty(psav); } -#undef WaitQueue -#define WaitQueue(x) SavageAccelSync(pScrn) /* * The XAA ROP helper routines all assume that a solid color is a @@ -704,7 +704,7 @@ SavageSubsequentScreenToScreenCopy( h ++; } - WaitQueue(6); + psav->WaitQueue(psav,6); BCI_SEND(psav->SavedBciCmd); if (psav->SavedBgColor != -1) BCI_SEND(psav->SavedBgColor); @@ -770,7 +770,7 @@ SavageSubsequentSolidFillRect( if( !w || !h ) return; - WaitQueue(5); + psav->WaitQueue(psav,5); BCI_SEND(psav->SavedBciCmd); if( psav->SavedBciCmd & BCI_CMD_SEND_COLOR ) @@ -854,7 +854,7 @@ SavageSubsequentScanlineCPUToScreenColorExpandFill( /* XAA will be sending bitmap data next. */ /* We should probably wait for empty/idle here. */ - WaitQueue(20); + psav->WaitQueue(psav,20); BCI_SEND(psav->SavedBciCmd); BCI_SEND(BCI_CLIP_LR(x+skipleft, x+w-1)); @@ -884,7 +884,7 @@ SavageSubsequentColorExpandScanline( if( xr.height ) { - WaitQueue(20); + psav->WaitQueue(psav,20); BCI_SEND(BCI_X_Y( xr.x, xr.y)); BCI_SEND(BCI_W_H( xr.width, 1 )); psav->Rect.height--; @@ -951,7 +951,16 @@ SavageSubsequentMono8x8PatternFillRect( SavagePtr psav = SAVPTR(pScrn); BCI_GET_PTR; - WaitQueue(7); + /* + * I didn't think it was my job to do trivial rejection, but + * miFillGeneralPolygon definitely generates null spans, and XAA + * just passes them through. + */ + + if( !w || !h ) + return; + + psav->WaitQueue(psav,7); BCI_SEND(psav->SavedBciCmd); if( psav->SavedBciCmd & BCI_CMD_SEND_COLOR ) BCI_SEND(psav->SavedFgColor); @@ -1015,7 +1024,10 @@ SavageSubsequentColor8x8PatternFillRect( SavagePtr psav = SAVPTR(pScrn); BCI_GET_PTR; - WaitQueue(5); + if( !w || !h ) + return; + + psav->WaitQueue(psav,5); BCI_SEND(psav->SavedBciCmd); BCI_SEND(psav->SavedSbdOffset); BCI_SEND(psav->SavedSbd); @@ -1047,7 +1059,7 @@ SavageSubsequentSolidBresenhamLine( x1, y1, length, octant, e2, e1, psav->SavedFgColor ); #endif - WaitQueue( 5 ); + psav->WaitQueue(psav, 5 ); BCI_SEND(cmd); if( cmd & BCI_CMD_SEND_COLOR ) BCI_SEND( psav->SavedFgColor ); @@ -1112,7 +1124,7 @@ SavageSubsequentSolidTwoPointLine( cmd = (psav->SavedBciCmd & 0x00ffffff); cmd |= BCI_CMD_LINE_LAST_PIXEL; - WaitQueue(5); + psav->WaitQueue(psav,5); BCI_SEND( cmd ); if( cmd & BCI_CMD_SEND_COLOR ) BCI_SEND( psav->SavedFgColor ); @@ -1140,7 +1152,7 @@ SavageSetClippingRectangle( #endif cmd = BCI_CMD_NOP | BCI_CMD_CLIP_NEW; - WaitQueue(3); + psav->WaitQueue(psav,3); BCI_SEND(cmd); BCI_SEND(BCI_CLIP_TL(y1, x1)); BCI_SEND(BCI_CLIP_BR(y2, x2)); @@ -1154,91 +1166,10 @@ static void SavageDisableClipping( ScrnInfoPtr pScrn ) #ifdef DEBUG_EXTRA ErrorF("Kill ClipRect\n"); #endif - psav->SavedBciCmd &= ~BCI_CMD_CLIP_NEW; + psav->SavedBciCmd &= ~BCI_CMD_CLIP_CURRENT; } -/* Trapezoid solid fills. XAA passes the coordinates of the top start - * and end points, and the slopes of the left and right vertexes. We - * use this info to generate the bottom points. We use a mixture of - * floating-point and fixed point logic; the biases are done in fixed - * point. Essentially, these were determined experimentally. The function - * passes xtest, but I suspect that it will not match cfb for large polygons. - * - * This code is from the ViRGE. We need to modify it for Savage if we ever - * decide to turn it on. - */ - -#if 0 -void -SavageSubsequentSolidFillTrap( - ScrnInfoPtr pScrn, - int y, - int h, - int left, - int dxl, - int dyl, - int el, - int right, - int dxr, - int dyr, - int er) -{ - int l_xdelta, r_xdelta; - double lendx, rendx, dl_delta, dr_delta; - int lbias, rbias; - unsigned int cmd; - double l_sgn = -1.0, r_sgn = -1.0; - - cmd |= (CMD_POLYFILL | CMD_AUTOEXEC | MIX_MONO_PATT) ; - cmd |= (psav->SavedRectCmdForLine & (0xff << 17)); - - l_xdelta = -(dxl << 20)/ dyl; - r_xdelta = -(dxr << 20)/ dyr; - - dl_delta = -(double) dxl / (double) dyl; - dr_delta = -(double) dxr / (double) dyr; - if (dl_delta < 0.0) l_sgn = 1.0; - if (dr_delta < 0.0) r_sgn = 1.0; - - lendx = l_sgn * ((double) el / (double) dyl) + left + ((h - 1) * dxl) / (double) dyl; - rendx = r_sgn * ((double) er / (double) dyr) + right + ((h - 1) * dxr) / (double) dyr; - - /* We now have four cases */ - - if (fabs(dl_delta) > 1.0) { /* XMAJOR line */ - if (dxl > 0) { lbias = ((1 << 20) - h); } - else { lbias = 0; } - } - else { - if (dxl > 0) { lbias = ((1 << 20) - 1) + l_xdelta / 2; } - else { lbias = 0; } - } - - if (fabs(dr_delta) > 1.0) { /* XMAJOR line */ - if (dxr > 0) { rbias = (1 << 20); } - else { rbias = ((1 << 20) - 1); } - } - else { - if (dxr > 0) { rbias = (1 << 20); } - else { rbias = ((1 << 20) - 1); } - } - - WaitQueue(8); - CACHE_SETP_CMD_SET(cmd); - SETP_PRDX(r_xdelta); - SETP_PLDX(l_xdelta); - SETP_PRXSTART(((int) (rendx * (double) (1 << 20))) + rbias); - SETP_PLXSTART(((int) (lendx * (double) (1 << 20))) + lbias); - - SETP_PYSTART(y + h - 1); - SETP_PYCNT((h) | 0x30000000); - - CACHE_SETB_CMD_SET(psav->SavedRectCmdForLine); - -} -#endif - /* Routines for debugging. */ unsigned long diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c index b14887d38..cba254710 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c,v 1.1 2001/02/13 21:15:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c,v 1.2 2001/04/18 15:29:19 dawes Exp $ */ /* Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. @@ -41,15 +41,11 @@ in this Software without prior written authorization from the XFree86 Project. static Bool Savage_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, int *, int *, int *); static Bool Savage_SetMode(ScrnInfoPtr, DGAModePtr); -static int Savage_GetViewport(ScrnInfoPtr); +static int Savage_GetViewport(ScrnInfoPtr); static void Savage_SetViewport(ScrnInfoPtr, int, int, int); static void Savage_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); static void Savage_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); -#if 0 -static void MGA_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, - unsigned long); -#endif static DGAFunctionRec Savage_DGAFuncs = { @@ -64,6 +60,7 @@ DGAFunctionRec Savage_DGAFuncs = { NULL /* BlitTransRect */ }; +#define DGATRACE 4 /* * I don't understand the thinking here. As near as I can tell, we are @@ -92,10 +89,16 @@ SavageSetupDGAMode( int otherPitch, Bpp = bitsPerPixel >> 3; Bool oneMore; - xf86ErrorFVerb(3, " SavageSetupDGAMode\n"); + xf86ErrorFVerb(DGATRACE, " SavageSetupDGAMode\n"); pMode = firstMode = pScrn->modes; + /* + * DGA 1.0 would only provide modes where the depth and stride + * matched the current desktop. Some DGA apps might still expect + * this, so we provide them, too. + */ + while(pMode) { otherPitch = secondPitch ? secondPitch : pMode->HDisplay; @@ -142,7 +145,7 @@ SECOND_PASS: mode->offset = 0; mode->address = psav->FBBase; - xf86ErrorFVerb(3, + xf86ErrorFVerb(DGATRACE, "SavageDGAInit vpWid=%d, vpHgt=%d, Bpp=%d, mdbitsPP=%d\n", mode->viewportWidth, mode->viewportHeight, @@ -161,8 +164,8 @@ SECOND_PASS: mode->maxViewportY = mode->imageHeight - mode->viewportHeight; oneMore = FALSE; - xf86ErrorFVerb(3, - "SavageDGAInit imgHgt=%d, stride=%d\n", + xf86ErrorFVerb(DGATRACE, + "SavageDGAInit 1 imgHgt=%d, stride=%d\n", mode->imageHeight, mode->bytesPerScanline ); @@ -176,6 +179,11 @@ SECOND_PASS: mode->maxViewportX = mode->imageWidth - mode->viewportWidth; /* this might need to get clamped to some maximum */ mode->maxViewportY = mode->imageHeight - mode->viewportHeight; + + xf86ErrorFVerb(DGATRACE, + "SavageDGAInit 2 imgHgt=%d, stride=%d\n", + mode->imageHeight, + mode->bytesPerScanline ); } pMode = pMode->next; @@ -195,7 +203,7 @@ SavageDGAInit(ScreenPtr pScreen) DGAModePtr modes = NULL; int num = 0; - xf86ErrorFVerb(3, " SavageDGAInit\n"); + xf86ErrorFVerb(DGATRACE, " SavageDGAInit\n"); /* 8 */ modes = SavageSetupDGAMode (pScrn, modes, &num, 8, 8, @@ -225,20 +233,7 @@ SavageDGAInit(ScreenPtr pScreen) (pScrn->depth != 16) ? 0 : pScrn->displayWidth, 0xf800, 0x07e0, 0x001f, DirectColor); -#if 0 - /* 24 */ - modes = SavageSetupDGAMode (pScrn, modes, &num, 24, 24, - (pScrn->bitsPerPixel == 24), - (pScrn->bitsPerPixel != 24) ? 0 : pScrn->displayWidth, - 0xff0000, 0x00ff00, 0x0000ff, TrueColor); - - modes = SavageSetupDGAMode (pScrn, modes, &num, 24, 24, - (pScrn->bitsPerPixel == 24), - (pScrn->bitsPerPixel != 24) ? 0 : pScrn->displayWidth, - 0xff0000, 0x00ff00, 0x0000ff, DirectColor); -#endif - - /* 32 */ + /* 24-in-32 */ modes = SavageSetupDGAMode (pScrn, modes, &num, 32, 24, (pScrn->bitsPerPixel == 32), (pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth, @@ -290,14 +285,14 @@ Savage_SetMode( pMode->bitsPerPixel, pMode->depth); #endif + if( psav->hwcursor ) + SavageHideCursor(pScrn); + if(!psav->DGAactive) { /* save the old parameters */ OldDisplayWidth[index] = pScrn->displayWidth; OldBitsPerPixel[index] = pScrn->bitsPerPixel; OldDepth[index] = pScrn->depth; - if( psav->hwcursor ) - SavageHideCursor(pScrn); - psav->DGAactive = TRUE; } 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 0be456c2e..633013a49 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.12 2001/03/08 17:12:11 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.15 2001/04/20 02:52:45 tsi Exp $ */ /* * vim: sw=4 ts=8 ai ic: * @@ -77,10 +77,10 @@ extern ScrnInfoPtr gpScrn; #define iabs(a) ((int)(a)>0?(a):(-(a))) #define DRIVER_NAME "savage" -#define DRIVER_VERSION "1.1.12" +#define DRIVER_VERSION "1.1.16" #define VERSION_MAJOR 1 #define VERSION_MINOR 1 -#define PATCHLEVEL 12 +#define PATCHLEVEL 16 #define SAVAGE_VERSION ((VERSION_MAJOR << 24) | \ (VERSION_MINOR << 16) | \ PATCHLEVEL) @@ -119,8 +119,8 @@ static SymTabRec SavageChips[] = { { PCI_CHIP_PROSAVAGE_PM, "ProSavage PM133" }, { PCI_CHIP_PROSAVAGE_KM, "ProSavage KM133" }, /* Twister is a code name; hope I get the real name soon. */ - { PCI_CHIP_TWISTER_P, "TwisterP" }, - { PCI_CHIP_TWISTER_K, "TwisterK" }, + { PCI_CHIP_S3TWISTER_P, "Twister" }, + { PCI_CHIP_S3TWISTER_K, "TwisterK" }, { -1, NULL } }; @@ -128,8 +128,8 @@ static SymTabRec SavageChipsets[] = { { S3_SAVAGE3D, "Savage3D" }, { S3_SAVAGE4, "Savage4" }, { S3_SAVAGE2000, "Savage2000" }, - { S3_SAVAGE_MX, "Savage/MX or /IX" }, - { S3_PROSAVAGE, "ProSavage PM133" }, + { S3_SAVAGE_MX, "MobileSavage" }, + { S3_PROSAVAGE, "ProSavage/Twister" }, { -1, NULL } }; @@ -146,16 +146,13 @@ static PciChipsets SavagePciChipsets[] = { { S3_SAVAGE_MX, PCI_CHIP_SAVAGE_IX, RES_SHARED_VGA }, { S3_PROSAVAGE, PCI_CHIP_PROSAVAGE_PM, RES_SHARED_VGA }, { S3_PROSAVAGE, PCI_CHIP_PROSAVAGE_KM, RES_SHARED_VGA }, - { S3_PROSAVAGE, PCI_CHIP_TWISTER_P, RES_SHARED_VGA }, - { S3_PROSAVAGE, PCI_CHIP_TWISTER_K, RES_SHARED_VGA }, + { S3_PROSAVAGE, PCI_CHIP_S3TWISTER_P, RES_SHARED_VGA }, + { S3_PROSAVAGE, PCI_CHIP_S3TWISTER_K, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; typedef enum { OPTION_PCI_BURST, - OPTION_FIFO_CONSERV, - OPTION_FIFO_MODERATE, - OPTION_FIFO_AGGRESSIVE, OPTION_PCI_RETRY, OPTION_NOACCEL, OPTION_LCD_CENTER, @@ -168,8 +165,7 @@ typedef enum { OPTION_SHADOW_FB, OPTION_ROTATE, OPTION_USEBIOS, - OPTION_STATUS_DELAY, - OPTION_STATUS_HACK + OPTION_SHADOW_STATUS } SavageOpts; @@ -182,8 +178,7 @@ static OptionInfoRec SavageOptions[] = { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, { OPTION_USEBIOS, "UseBIOS", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_LCDCLOCK, "LCDClock", OPTV_FREQ, {0}, FALSE }, - { OPTION_STATUS_DELAY, "StatusDelay", OPTV_INTEGER, {0}, FALSE }, - { OPTION_STATUS_HACK, "StatusHack", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SHADOW_STATUS, "ShadowStatus", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -218,6 +213,13 @@ static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", "vbeFree", + NULL +}; + +static const char *vbeOptSymbols[] = { +#if 0 + "vbeModeInit", +#endif "VBESetVBEMode", NULL }; @@ -335,6 +337,34 @@ ResetBCI2K( SavagePtr psav ) } } +static Bool +ShadowWait( SavagePtr psav ) +{ + BCI_GET_PTR; + static int dwBCIWait2DIdle = 0; + int loop = 0; + + if( !dwBCIWait2DIdle ) + { + if( psav->Chipset == S3_SAVAGE2000 ) + dwBCIWait2DIdle = 0xc0040000; + else + dwBCIWait2DIdle = 0xc0020000; + } + + psav->ShadowCounter = (psav->ShadowCounter + 1) & 0x7fff; + BCI_SEND( dwBCIWait2DIdle ); + BCI_SEND( 0x98000000 + psav->ShadowCounter ); + + while( + (psav->ShadowVirtual[1] & 0x7fff) != psav->ShadowCounter && + (loop++ < MAXLOOP) + ) + ; + + return loop >= MAXLOOP; +} + /* Wait until "v" queue entries are free */ static int @@ -344,9 +374,17 @@ WaitQueue3D( SavagePtr psav, int v ) int slots = MAXFIFO - v; mem_barrier(); - loop &= STATUS_WORD0; - while( ((STATUS_WORD0 & 0x0000ffff) > slots) && (loop++ < MAXLOOP)) - ; + if( psav->ShadowVirtual ) + { + psav->WaitIdle = ShadowWait; + return ShadowWait(psav); + } + else + { + loop &= STATUS_WORD0; + while( ((STATUS_WORD0 & 0x0000ffff) > slots) && (loop++ < MAXLOOP)) + ; + } return loop >= MAXLOOP; } @@ -359,8 +397,14 @@ WaitQueue4( SavagePtr psav, int v ) if( !psav->NoPCIRetry ) return 0; mem_barrier(); - while( ((ALT_STATUS_WORD0 & 0x001fffff) > slots) && (loop++ < MAXLOOP)) - ; + if( psav->ShadowVirtual ) + { + psav->WaitIdle = ShadowWait; + return ShadowWait(psav); + } + else + while( ((ALT_STATUS_WORD0 & 0x001fffff) > slots) && (loop++ < MAXLOOP)) + ; return loop >= MAXLOOP; } @@ -373,8 +417,14 @@ WaitQueue2K( SavagePtr psav, int v ) if( !psav->NoPCIRetry ) return 0; mem_barrier(); - while( ((ALT_STATUS_WORD0 & 0x000fffff) > slots) && (loop++ < MAXLOOP)) - ; + if( psav->ShadowVirtual ) + { + psav->WaitIdle = ShadowWait; + return ShadowWait(psav); + } + else + while( ((ALT_STATUS_WORD0 & 0x000fffff) > slots) && (loop++ < MAXLOOP)) + ; if( loop >= MAXLOOP ) ResetBCI2K(psav); return loop >= MAXLOOP; @@ -387,6 +437,11 @@ WaitIdleEmpty3D(SavagePtr psav) { int loop = 0; mem_barrier(); + if( psav->ShadowVirtual ) + { + psav->WaitIdleEmpty = ShadowWait; + return ShadowWait(psav); + } loop &= STATUS_WORD0; while( ((STATUS_WORD0 & 0x0008ffff) != 0x80000) && (loop++ < MAXLOOP) ) ; @@ -398,6 +453,11 @@ WaitIdleEmpty4(SavagePtr psav) { int loop = 0; mem_barrier(); + if( psav->ShadowVirtual ) + { + psav->WaitIdleEmpty = ShadowWait; + return ShadowWait(psav); + } while( ((ALT_STATUS_WORD0 & 0x00a1ffff) != 0x00a00000) && (loop++ < MAXLOOP) ) ; return loop >= MAXLOOP; @@ -408,6 +468,11 @@ WaitIdleEmpty2K(SavagePtr psav) { int loop = 0; mem_barrier(); + if( psav->ShadowVirtual ) + { + psav->WaitIdleEmpty = ShadowWait; + return ShadowWait(psav); + } loop &= ALT_STATUS_WORD0; while( ((ALT_STATUS_WORD0 & 0x009fffff) != 0) && (loop++ < MAXLOOP) ) ; @@ -423,6 +488,11 @@ WaitIdle3D(SavagePtr psav) { int loop = 0; mem_barrier(); + if( psav->ShadowVirtual ) + { + psav->WaitIdle = ShadowWait; + return ShadowWait(psav); + } while( (!(STATUS_WORD0 & 0x00080000)) && (loop++ < MAXLOOP) ) ; return loop >= MAXLOOP; @@ -433,6 +503,11 @@ WaitIdle4(SavagePtr psav) { int loop = 0; mem_barrier(); + if( psav->ShadowVirtual ) + { + psav->WaitIdle = ShadowWait; + return ShadowWait(psav); + } while( (!(ALT_STATUS_WORD0 & 0x00800000)) && (loop++ < MAXLOOP) ) ; return loop >= MAXLOOP; @@ -443,43 +518,17 @@ WaitIdle2K(SavagePtr psav) { int loop = 0; mem_barrier(); + if( psav->ShadowVirtual ) + { + psav->WaitIdle = ShadowWait; + return ShadowWait(psav); + } loop &= ALT_STATUS_WORD0; while( (ALT_STATUS_WORD0 & 0x00900000) && (loop++ < MAXLOOP) ) ; return loop >= MAXLOOP; } -/* Wait until Command FIFO is empty */ - - -static int -WaitCommandEmpty3D(SavagePtr psav) { - int loop = 0; - mem_barrier(); - while( (STATUS_WORD0 & 0x0000ffff) && (loop++ < MAXLOOP) ) - ; - return loop >= MAXLOOP; -} - -static int -WaitCommandEmpty4(SavagePtr psav) { - int loop = 0; - mem_barrier(); - while( (ALT_STATUS_WORD0 & 0x0001ffff) && (loop++ < MAXLOOP) ) - ; - return loop >= MAXLOOP; -} - -static int -WaitCommandEmpty2K(SavagePtr psav) { - int loop = 0; - mem_barrier(); - while( (ALT_STATUS_WORD0 & 0x001fffff) && (loop++ < MAXLOOP) ) - ; - if( loop >= MAXLOOP ) - ResetBCI2K(psav); - return loop >= MAXLOOP; -} static Bool SavageGetRec(ScrnInfoPtr pScrn) { @@ -711,21 +760,6 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"pci_retry\" option requires \"pci_burst\"\n"); } - xf86GetOptValBool( SavageOptions, OPTION_FIFO_CONSERV, &psav->fifo_conservative ); - if (psav->fifo_conservative) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo conservative set\n"); - } - - xf86GetOptValBool( SavageOptions, OPTION_FIFO_CONSERV, &psav->fifo_moderate ); - if (psav->fifo_moderate) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo moderate set\n"); - } - - xf86GetOptValBool( SavageOptions, OPTION_FIFO_CONSERV, &psav->fifo_aggressive ); - if (psav->fifo_aggressive) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo aggressive set\n"); - } - xf86GetOptValBool( SavageOptions, OPTION_SHADOW_FB, &psav->shadowFB ); if (psav->shadowFB) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: shadow FB enabled\n"); @@ -790,14 +824,9 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, "Option: LCDClock %1.2f MHz\n", psav->LCDClock ); - psav->StatusDelay = 0; - if( xf86GetOptValInteger( SavageOptions, OPTION_STATUS_DELAY, &psav->StatusDelay ) ) + if( xf86GetOptValBool( SavageOptions, OPTION_SHADOW_STATUS, &psav->ShadowStatus)) xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, - "Option: StatusDelay %d microseconds\n", psav->StatusDelay ); - - if( xf86GetOptValBool( SavageOptions, OPTION_STATUS_HACK, &psav->StatusHack)) - xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, - "Option: StatusHack enabled\n" ); + "Option: ShadowStatus enabled\n" ); /* Add more options here. */ @@ -822,6 +851,9 @@ 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); } @@ -921,7 +953,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) psav->MemOffScreen = 0; if (!pScrn->videoRam) { static unsigned char RamSavage3D[] = { 8, 4, 4, 2 }; - static unsigned char RamSavage4[] = { 2, 4, 8, 12, 16, 32, 64, 2 }; + static unsigned char RamSavage4[] = { 2, 4, 8, 12, 16, 32, 64, 32 }; static unsigned char RamSavageMX[] = { 2, 8, 4, 16, 8, 16, 4, 16 }; static unsigned char RamSavageNB[] = { 0, 2, 4, 8, 16, 32, 2, 2 }; @@ -1033,25 +1065,22 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) switch( psav->Chipset ) { case S3_SAVAGE3D: case S3_SAVAGE_MX: - psav->myWaitQueue = WaitQueue3D; - psav->myWaitIdle = WaitIdle3D; - psav->myWaitIdleEmpty = WaitIdleEmpty3D; - psav->myWaitCommandEmpty = WaitCommandEmpty3D; + psav->WaitQueue = WaitQueue3D; + psav->WaitIdle = WaitIdle3D; + psav->WaitIdleEmpty = WaitIdleEmpty3D; break; case S3_SAVAGE4: case S3_PROSAVAGE: - psav->myWaitQueue = WaitQueue4; - psav->myWaitIdle = WaitIdle4; - psav->myWaitIdleEmpty = WaitIdleEmpty4; - psav->myWaitCommandEmpty = WaitCommandEmpty4; + psav->WaitQueue = WaitQueue4; + psav->WaitIdle = WaitIdle4; + psav->WaitIdleEmpty = WaitIdleEmpty4; break; case S3_SAVAGE2000: - psav->myWaitQueue = WaitQueue2K; - psav->myWaitIdle = WaitIdle2K; - psav->myWaitIdleEmpty = WaitIdleEmpty2K; - psav->myWaitCommandEmpty = WaitCommandEmpty2K; + psav->WaitQueue = WaitQueue2K; + psav->WaitIdle = WaitIdle2K; + psav->WaitIdleEmpty = WaitIdleEmpty2K; break; } @@ -1190,10 +1219,8 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) "- Limiting video mode to %dx%d\n", panelX, panelY ); - if( pScrn->virtualX > panelX ) - pScrn->virtualX = panelX; - if( pScrn->virtualY > panelY ) - pScrn->virtualY = panelY; + psav->PanelX = panelX; + psav->PanelY = panelY; if( psav->LCDClock > 0.0 ) { @@ -1315,8 +1342,6 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) xf86LoaderReqSymLists(shadowSymbols, NULL); } - SavageUnmapMem(pScrn, 1); - return TRUE; } @@ -1462,11 +1487,14 @@ static void SavageSave(ScrnInfoPtr pScrn) save->CR65 = VGAIN8(vgaCRReg); /* save seq extended regs for DCLK PLL programming */ + VGAOUT8(0x3c4, 0x0e); + save->SR0E = VGAIN8(0x3c5); + VGAOUT8(0x3c4, 0x0f); + save->SR0F = VGAIN8(0x3c5); VGAOUT8(0x3c4, 0x10); save->SR10 = VGAIN8(0x3c5); VGAOUT8(0x3c4, 0x11); save->SR11 = VGAIN8(0x3c5); - VGAOUT8(0x3c4, 0x12); save->SR12 = VGAIN8(0x3c5); VGAOUT8(0x3c4, 0x13); @@ -1476,6 +1504,8 @@ static void SavageSave(ScrnInfoPtr pScrn) VGAOUT8(0x3c4, 0x15); save->SR15 = VGAIN8(0x3c5); + VGAOUT8(0x3c4, 0x30); + save->SR30 = VGAIN8(0x3c5); VGAOUT8(0x3c4, 0x18); save->SR18 = VGAIN8(0x3c5); @@ -1539,6 +1569,9 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, TRACE(("SavageWriteMode(%x)\n", restore->mode)); + if( Entering ) + SavageInitialize2DEngine(pScrn); + /* * If we figured out a VESA mode number for this timing, just use * the S3 BIOS to do the switching, with a few additional tweaks. @@ -1679,8 +1712,15 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, break; } + #if 0 if( !psav->NoAccel ) + { + #endif SavageInitialize2DEngine(pScrn); + SavageSetGBD(pScrn); +#if 0 + } +#endif VGAOUT16(vgaCRIndex, 0x0140); @@ -1733,12 +1773,14 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, VGAOUT8(vgaCRIndex, 0x53); VGAOUT8(vgaCRReg, restore->CR53 & 0x7f); - VGAOUT8(0x3c4, 0x08); - VGAOUT8(0x3c5, 0x06); - VGAOUT8(0x3c4, 0x12); - VGAOUT8(0x3c5, restore->SR12); - VGAOUT8(0x3c4, 0x13); - VGAOUT8(0x3c5, restore->SR13); + VGAOUT16(0x3c4, 0x0608); + + /* Restore DCLK registers. */ + + VGAOUT8(0x3c4, 0x0e); + VGAOUT8(0x3c5, restore->SR0E); + VGAOUT8(0x3c4, 0x0f); + VGAOUT8(0x3c5, restore->SR0F); VGAOUT8(0x3c4, 0x29); VGAOUT8(0x3c5, restore->SR29); VGAOUT8(0x3c4, 0x15); @@ -1839,6 +1881,10 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, } /* restore extended seq regs for dclk */ + VGAOUT8(0x3c4, 0x0e); + VGAOUT8(0x3c5, restore->SR0E); + VGAOUT8(0x3c4, 0x0f); + VGAOUT8(0x3c5, restore->SR0F); VGAOUT8(0x3c4, 0x12); VGAOUT8(0x3c5, restore->SR12); VGAOUT8(0x3c4, 0x13); @@ -1857,7 +1903,10 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, VGAOUT8(0x3c5, tmp | 0x23); VGAOUT8(0x3c5, tmp | 0x03); VGAOUT8(0x3c5, restore->SR15); + usleep( 100 ); + VGAOUT8(0x3c4, 0x30); + VGAOUT8(0x3c5, restore->SR30); VGAOUT8(0x3c4, 0x08); VGAOUT8(0x3c5, restore->SR08); @@ -1878,37 +1927,39 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, cr3a = VGAIN8(vgaCRReg); VGAOUT8(vgaCRReg, cr3a | 0x80); - if (psav->Entering) + if (Entering) SavageGEReset(pScrn,0,__LINE__,__FILE__); if( psav->Chipset != S3_SAVAGE_MX ) { VerticalRetraceWait(); OUTREG(FIFO_CONTROL_REG, restore->MMPR0); - WaitIdle(); + psav->WaitIdle(psav); OUTREG(MIU_CONTROL_REG, restore->MMPR1); - WaitIdle(); + psav->WaitIdle(psav); OUTREG(STREAMS_TIMEOUT_REG, restore->MMPR2); - WaitIdle(); + psav->WaitIdle(psav); OUTREG(MISC_TIMEOUT_REG, restore->MMPR3); } /* If we're going into graphics mode and acceleration was enabled, */ /* go set up the BCI buffer and the global bitmap descriptor. */ - if( psav->Entering && (!psav->NoAccel) ) +#if 0 + if( Entering && (!psav->NoAccel) ) { VGAOUT8(vgaCRIndex, 0x50); VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) | 0xC1); SavageInitialize2DEngine(pScrn); } +#endif VGAOUT8(vgaCRIndex, 0x66); VGAOUT8(vgaCRReg, cr66); VGAOUT8(vgaCRIndex, 0x3a); VGAOUT8(vgaCRReg, cr3a); - if( psav->Entering ) + if( Entering ) SavageSetGBD(pScrn); vgaHWProtect(pScrn, FALSE); @@ -1988,7 +2039,6 @@ static Bool SavageMapFB(ScrnInfoPtr pScrn) } pScrn->memPhysBase = psav->PciInfo->memBase[0]; pScrn->fbOffset = 0; -/* psav->FBCursorOffset = psav->videoRambytes - 1024; */ return TRUE; } @@ -2042,9 +2092,6 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, pScrn = xf86Screens[pScreen->myNum]; psav = SAVPTR(pScrn); - if (!SavageMapMMIO(pScrn)) - return FALSE; - SavageEnableMMIO(pScrn); if (!SavageMapFB(pScrn)) @@ -2063,18 +2110,14 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; -#if 0 if (!miSetPixmapDepths ()) return FALSE; -#endif } else { if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; -#if 0 if (!miSetPixmapDepths ()) return FALSE; -#endif } ret = SavageInternalScreenInit(scrnIndex, pScreen); @@ -2106,7 +2149,7 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); - if( !psav->numDGAModes ) + if( !psav->shadowFB ) SavageDGAInit(pScreen); miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); @@ -2119,7 +2162,6 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, if (psav->shadowFB) { RefreshAreaFuncPtr refreshArea = SavageRefreshArea; -#if 1 if(psav->rotate) { if (!psav->PointerMoved) { psav->PointerMoved = pScrn->PointerMoved; @@ -2133,7 +2175,6 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, case 32: refreshArea = SavageRefreshArea32; break; } } -#endif ShadowFBInit(pScreen, refreshArea); } @@ -2211,11 +2252,26 @@ static int SavageInternalScreenInit(int scrnIndex, ScreenPtr pScreen) } -static ModeStatus SavageValidMode(int index, DisplayModePtr mode, +static ModeStatus SavageValidMode(int index, DisplayModePtr pMode, Bool verbose, int flags) { - /* TODO check modes */ + ScrnInfoPtr pScrn = xf86Screens[index]; + SavagePtr psav = SAVPTR(pScrn); + TRACE(("SavageValidMode\n")); + + /* We prohibit modes bigger than the LCD panel. */ + /* TODO We should do this only if the panel is active. */ + + if( + (psav->PanelX) && + ( + (pMode->HDisplay > psav->PanelX) || + (pMode->VDisplay > psav->PanelY) + ) + ) + return MODE_PANEL; + return MODE_OK; } @@ -2287,22 +2343,28 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) switch( pScrn->depth ) { case 8: - if( (dclk <= 110000) && (psav->Chipset != S3_SAVAGE_MX) ) - new->CR67 = 0x10; /* 8bpp, 135Mhz */ + if( (psav->Chipset == S3_SAVAGE2000) && (dclk >= 230000) ) + new->CR67 = 0x10; /* 8bpp, 2 pixels/clock */ else - new->CR67 = 0x00; /* 8bpp, 220Mhz */ + new->CR67 = 0x00; /* 8bpp, 1 pixel/clock */ break; case 15: - if( (dclk <= 110000) && (psav->Chipset != S3_SAVAGE_MX) ) - new->CR67 = 0x20; /* 15bpp, 135Mhz */ + if( + (psav->Chipset == S3_SAVAGE_MX) || + ((psav->Chipset == S3_SAVAGE2000) && (dclk >= 230000)) + ) + new->CR67 = 0x30; /* 15bpp, 2 pixel/clock */ else - new->CR67 = 0x30; /* 15bpp, 220Mhz */ + new->CR67 = 0x20; /* 15bpp, 1 pixels/clock */ break; case 16: - if( (dclk <= 110000) && (psav->Chipset != S3_SAVAGE_MX) ) - new->CR67 = 0x40; /* 16bpp, 135Mhz */ + if( + (psav->Chipset == S3_SAVAGE_MX) || + ((psav->Chipset == S3_SAVAGE2000) && (dclk >= 230000)) + ) + new->CR67 = 0x50; /* 16bpp, 2 pixel/clock */ else - new->CR67 = 0x50; /* 16bpp, 220Mhz */ + new->CR67 = 0x40; /* 16bpp, 1 pixels/clock */ break; case 24: new->CR67 = 0xd0; @@ -2357,18 +2419,25 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) new->refresh = pmt->RefreshRate[jBest]; break; } - } - } + } - if( new->mode ) { - /* Success: we found a match in the BIOS. */ - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Chose mode %x at %dHz.\n", new->mode, new->refresh ); + if( new->mode ) { + /* Success: we found a match in the BIOS. */ + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Chose mode %x at %dHz.\n", new->mode, new->refresh ); + } + else { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "No suitable BIOS mode found for %dx%d %dMHz.\n", + mode->HDisplay, mode->VDisplay, mode->Clock/1000 ); + } } - else { - /* We failed to find a match in the BIOS. */ - /* Fallthrough to the traditional register-crunching. */ + if( !new->mode ) { + /* + * Either BIOS use is disabled, or we failed to find a suitable + * match. Fall back to traditional register-crunching. + */ VGAOUT8(vgaCRIndex, 0x3a); tmp = VGAIN8(vgaCRReg); @@ -2547,6 +2616,12 @@ static Bool SavageCloseScreen(int scrnIndex, ScreenPtr pScreen) psav->AccelInfoRec = NULL; } + if( psav->DGAModes ) { + xfree( psav->DGAModes ); + psav->DGAModes = NULL; + psav->numDGAModes = 0; + } + if (pScrn->vtSema) { SavageWriteMode(pScrn, vgaSavePtr, SavageSavePtr, FALSE); vgaHWLock(hwp); @@ -2565,7 +2640,7 @@ static Bool SavageSaveScreen(ScreenPtr pScreen, int mode) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; TRACE(("SavageSaveScreen(0x%x)\n", mode)); - if( SAVPTR(pScrn)->hwcursor ) + if( pScrn->vtSema && SAVPTR(pScrn)->hwcursor ) { if( xf86IsUnblank(mode) ) SavageShowCursor( pScrn ); @@ -2765,7 +2840,7 @@ void SavageGEReset(ScrnInfoPtr pScrn, int from_timeout, int line, char *file) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "SavageGEReset called from %s line %d\n", file, line); } else - WaitIdleEmpty(); + psav->WaitIdleEmpty(psav); if (from_timeout && (psav->Chipset != S3_SAVAGE_MX) ) { fifo_control = INREG(FIFO_CONTROL_REG); @@ -2785,7 +2860,7 @@ void SavageGEReset(ScrnInfoPtr pScrn, int from_timeout, int line, char *file) usleep(10000); if (!from_timeout) - WaitIdleEmpty(); + psav->WaitIdleEmpty(psav); OUTREG(DEST_SRC_STR, psav->Bpl << 16 | psav->Bpl); usleep(10000); @@ -2811,6 +2886,8 @@ void SavageGEReset(ScrnInfoPtr pScrn, int from_timeout, int line, char *file) break; } + /* At this point, the FIFO is empty and the engine is idle. */ + if (from_timeout && (psav->Chipset != S3_SAVAGE_MX) ) { OUTREG(FIFO_CONTROL_REG, fifo_control); OUTREG(MIU_CONTROL_REG, miu_control); @@ -2818,15 +2895,13 @@ void SavageGEReset(ScrnInfoPtr pScrn, int from_timeout, int line, char *file) OUTREG(MISC_TIMEOUT_REG, misc_timeout); } - WaitQueue(2); OUTREG(SRC_BASE, 0); OUTREG(DEST_BASE, 0); - - WaitQueue(4); OUTREG(CLIP_L_R, ((0) << 16) | pScrn->displayWidth); OUTREG(CLIP_T_B, ((0) << 16) | psav->ScissB); OUTREG(MONO_PAT_0, ~0); OUTREG(MONO_PAT_1, ~0); + SavageSetGBD(pScrn); } 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 24929fb6c..f8f5abb0b 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: $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v 1.7 2001/04/27 12:58:28 dawes Exp $ */ #ifndef SAVAGE_VGAHWMMIO_H #define SAVAGE_VGAHWMMIO_H @@ -53,8 +53,8 @@ typedef struct _S3VMODETABLE { typedef struct { unsigned int mode, refresh; - unsigned char SR08, SR0A, SR0F; - unsigned char SR10, SR11, SR12, SR13, SR15, SR18, SR29; + unsigned char SR08, SR0E, SR0F; + unsigned char SR10, SR11, SR12, SR13, SR15, SR18, SR29, SR30; unsigned char SR54[8]; unsigned char Clock; unsigned char CR31, CR32, CR33, CR34, CR36, CR3A, CR3B, CR3C; @@ -63,7 +63,6 @@ typedef struct { unsigned char CR60, CR63, CR65, CR66, CR67, CR68, CR69, CR6D, CR6F; unsigned char CR86, CR88; unsigned char CR90, CR91, CRB0; - unsigned char ColorStack[8]; unsigned int STREAMS[22]; /* yuck, streams regs */ unsigned int MMPR0, MMPR1, MMPR2, MMPR3; } SavageRegRec, *SavageRegPtr; @@ -88,6 +87,7 @@ typedef struct _Savage { /* These are physical addresses. */ unsigned long FrameBufferBase; unsigned long MmioBase; + unsigned long ShadowPhysical; /* These are linear addresses. */ unsigned char* MapBase; @@ -95,6 +95,7 @@ typedef struct _Savage { unsigned char* MapBaseDense; unsigned char* FBBase; unsigned char* FBStart; + unsigned long volatile * ShadowVirtual; Bool PrimaryVidMapped; int dacSpeedBpp; @@ -118,8 +119,9 @@ typedef struct _Savage { Bool UseBIOS; int rotate; double LCDClock; - int StatusDelay; - Bool StatusHack; + Bool ShadowStatus; + int PanelX; + int PanelY; CloseScreenProcPtr CloseScreen; pciVideoPtr PciInfo; @@ -129,12 +131,12 @@ typedef struct _Savage { int ChipRev; vbeInfoPtr pVbe; int EntityIndex; + int ShadowCounter; /* The various Savage wait handlers. */ - int (*myWaitQueue)(struct _Savage *, int); - int (*myWaitIdle)(struct _Savage *); - int (*myWaitIdleEmpty)(struct _Savage *); - int (*myWaitCommandEmpty)(struct _Savage *); + int (*WaitQueue)(struct _Savage *, int); + int (*WaitIdle)(struct _Savage *); + int (*WaitIdleEmpty)(struct _Savage *); /* Support for shadowFB and rotation */ unsigned char * ShadowPtr; @@ -147,11 +149,8 @@ typedef struct _Savage { unsigned int SavedBciCmd; unsigned int SavedFgColor; unsigned int SavedBgColor; - unsigned int SavedGbdOffset; - unsigned int SavedGbd; unsigned int SavedSbdOffset; unsigned int SavedSbd; - Bool Entering; /* Support for Int10 processing */ xf86Int10InfoPtr pInt10; @@ -182,14 +181,6 @@ typedef struct _Savage { #define VF_STREAMS_ON 0x0001 - -/* Shortcuts. These depend on a local symbol "psav". */ - -#define WaitIdle() psav->myWaitIdle(psav) -#define WaitIdleEmpty() psav->myWaitIdleEmpty(psav) -#define WaitQueue(k) psav->myWaitQueue(psav,k) -#define WaitCommandEmpty() psav->myWaitCommandEmpty(psav) - #define SAVPTR(p) ((SavagePtr)((p)->driverPrivate)) /* Prototypes. */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c index 382ac54b0..34a13a56b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c,v 1.2 2000/12/04 18:50:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c,v 1.3 2001/04/18 15:29:19 dawes Exp $ */ #include "savage_driver.h" #include "xaarop.h" @@ -38,7 +38,7 @@ void SavageWriteBitmapScreenToScreenColorExpand( BCI_BD_SET_STRIDE(bd, srcwidth); bd_offset = srcwidth * srcy + (srcx >> 3) + src; - WaitQueue(10); + psav->WaitQueue(psav,10); BCI_SEND(cmd); BCI_SEND((unsigned int)bd_offset); BCI_SEND(bd); @@ -158,7 +158,7 @@ void SavageSubsequentImageWriteRect int count; count = ((w * pScrn->bitsPerPixel + 31) / 32) * h; - WaitQueue( count ); + psav->WaitQueue( psav, count ); BCI_SEND(psav->SavedBciCmd); BCI_SEND(BCI_CLIP_LR(x+skipleft, x+w-1)); if( psav->SavedBgColor != -1 ) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h index c730eb290..e1a046b01 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h @@ -1,13 +1,15 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h,v 1.7 2001/04/27 12:58:28 dawes Exp $ */ + #ifndef _SAVAGE_REGS_H #define _SAVAGE_REGS_H /* These are here until xf86PciInfo.h is updated. */ -#ifndef PCI_CHIP_TWISTER_P -#define PCI_CHIP_TWISTER_P 0x8d01 +#ifndef PCI_CHIP_S3TWISTER_P +#define PCI_CHIP_S3TWISTER_P 0x8d01 #endif -#ifndef PCI_CHIP_TWISTER_K -#define PCI_CHIP_TWISTER_K 0x8d02 +#ifndef PCI_CHIP_S3TWISTER_K +#define PCI_CHIP_S3TWISTER_K 0x8d02 #endif #define S3_SAVAGE3D_SERIES(chip) ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE_MX)) @@ -73,6 +75,8 @@ enum S3CHIPTAGS { #define SEC_STREAM_HSCALING 0x81a0 /* Secondary Stream 1 Frame Buffer Size */ #define SEC_STREAM_BUFFERSIZE 0x81a8 +/* Secondary Stream 1 Horizontal Scaling Normalization (2K only) */ +#define SEC_STREAM_HSCALE_NORMALIZE 0x81ac /* Secondary Stream 1 Horizontal Scaling */ #define SEC_STREAM_VSCALING 0x81e8 /* Secondary Stream 1 Frame Buffer Address 0 */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c index 0833232e6..49b60bb59 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c @@ -1,8 +1,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c,v 1.3 2001/02/15 20:00:20 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c,v 1.6 2001/04/19 14:07:05 tsi Exp $ */ #include "savage_driver.h" #include "savage_vbe.h" -#include "vbe.h" #if X_BYTE_ORDER == X_LITTLE_ENDIAN #define B_O16(x) (x) @@ -14,6 +13,9 @@ #endif #define L_ADD(x) (B_O32(x) & 0xffff) + ((B_O32(x) >> 12) & 0xffff00) +#if 0 +Bool vbeModeInit( vbeInfoPtr, int ); +#endif static void SavageClearVM86Regs( xf86Int10InfoPtr pInt ) @@ -54,10 +56,22 @@ SavageSetVESAMode( SavagePtr psav, int n, int Refresh ) /* Now, make this mode current. */ - if( !VBESetVBEMode( psav->pVbe, n, NULL ) ) + if( xf86LoaderCheckSymbol( "VBESetVBEMode" ) ) + { + if( !VBESetVBEMode( psav->pVbe, n, NULL ) ) + { + ErrorF("Set video mode failed\n"); + } + } +#if 0 + else { - ErrorF("Set video mode failed\n"); + if( !vbeModeInit( psav->pVbe, n ) ) + { + ErrorF("Set video mode failed\n"); + } } +#endif } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c index 3f6ee49f7..221111c85 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c,v 1.1 2001/02/13 21:15:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c,v 1.2 2001/04/18 15:29:19 dawes Exp $ */ #include "Xv.h" #include "dix.h" @@ -35,10 +35,46 @@ static int SavagePutImage( ScrnInfoPtr, static int SavageQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *); +static void SavageInitStreamsOld(ScrnInfoPtr pScrn); +static void SavageInitStreamsNew(ScrnInfoPtr pScrn); +static void (*SavageInitStreams)(ScrnInfoPtr pScrn) = NULL; + +static void SavageSetColorKeyOld(ScrnInfoPtr pScrn); +static void SavageSetColorKeyNew(ScrnInfoPtr pScrn); +static void (*SavageSetColorKey)(ScrnInfoPtr pScrn) = NULL; + +static void SavageSetColorOld(ScrnInfoPtr pScrn ); +static void SavageSetColorNew(ScrnInfoPtr pScrn ); +static void (*SavageSetColor)(ScrnInfoPtr pScrn ) = NULL; + +static void SavageDisplayVideoOld( + ScrnInfoPtr pScrn, int id, int offset, + short width, short height, int pitch, + int x1, int y1, int x2, int y2, + BoxPtr dstBox, + short src_w, short src_h, + short drw_w, short drw_h +); +static void SavageDisplayVideoNew( + ScrnInfoPtr pScrn, int id, int offset, + short width, short height, int pitch, + int x1, int y1, int x2, int y2, + BoxPtr dstBox, + short src_w, short src_h, + short drw_w, short drw_h +); +static void (*SavageDisplayVideo)( + ScrnInfoPtr pScrn, int id, int offset, + short width, short height, int pitch, + int x1, int y1, int x2, int y2, + BoxPtr dstBox, + short src_w, short src_h, + short drw_w, short drw_h +) = NULL; + /*static void SavageBlockHandler(int, pointer, pointer, pointer);*/ -/*#define XVTRACE*/ -/*#define XVTRACE1*/ +#define XVTRACE 4 #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) @@ -83,7 +119,6 @@ static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = * For completeness sake, here is a cracking of the fourcc's I support. * * YUY2, packed 4:2:2, byte order: Y0 U0 Y1 V0 Y2 U2 Y3 V2 - * UYVY, packed 4:2:2, byte order: U0 Y0 V0 Y1 U2 Y2 V2 Y3 * Y211, packed 2:1:1, byte order: Y0 U0 Y2 V0 Y4 U2 Y6 V2 * YV12, planar 4:1:1, Y plane HxW, V plane H/2xW/2, U plane H/2xW/2 * I420, planar 4:1:1, Y plane HxW, U plane H/2xW/2, V plane H/2xW/2 @@ -96,7 +131,6 @@ static XF86ImageRec Images[NUM_IMAGES] = XVIMAGE_YUY2, XVIMAGE_YV12, XVIMAGE_I420, - XVIMAGE_UYVY, { FOURCC_RV16, XvRGB, @@ -162,6 +196,7 @@ typedef struct { CARD32 videoStatus; Time offTime; Time freeTime; + int lastKnownPitch; } SavagePortPrivRec, *SavagePortPrivPtr; @@ -173,6 +208,9 @@ typedef struct { **************************************/ #define EXT_MISC_CTRL2 0x67 + +/* New streams */ + /* CR67[2] = 1 : enable stream 1 */ #define ENABLE_STREAM1 0x04 /* CR67[1] = 1 : enable stream 2 */ @@ -182,35 +220,140 @@ typedef struct { /* CR67[3] = 1 : Mem-mapped regs */ #define USE_MM_FOR_PRI_STREAM 0x08 +/* Old Streams */ + +#define ENABLE_STREAMS_OLD 0x0c +#define NO_STREAMS_OLD 0xf3 +/* CR69[0] = 1 : Mem-mapped regs */ +#define USE_MM_FOR_PRI_STREAM_OLD 0x01 + + +/* + * There are two different streams engines used in the Savage line. + * The old engine is in the 3D, 4, Pro, and Twister. + * The new engine is in the 2000, MX and IX. + */ + + +/* streams registers for old engine */ +#define PSTREAM_CONTROL_REG 0x8180 +#define COL_CHROMA_KEY_CONTROL_REG 0x8184 +#define SSTREAM_CONTROL_REG 0x8190 +#define CHROMA_KEY_UPPER_BOUND_REG 0x8194 +#define SSTREAM_STRETCH_REG 0x8198 +#define COLOR_ADJUSTMENT_REG 0x819C +#define BLEND_CONTROL_REG 0x81A0 +#define PSTREAM_FBADDR0_REG 0x81C0 +#define PSTREAM_FBADDR1_REG 0x81C4 +#define PSTREAM_STRIDE_REG 0x81C8 +#define DOUBLE_BUFFER_REG 0x81CC +#define SSTREAM_FBADDR0_REG 0x81D0 +#define SSTREAM_FBADDR1_REG 0x81D4 +#define SSTREAM_STRIDE_REG 0x81D8 +#define SSTREAM_VSCALE_REG 0x81E0 +#define SSTREAM_VINITIAL_REG 0x81E4 +#define SSTREAM_LINES_REG 0x81E8 +#define STREAMS_FIFO_REG 0x81EC +#define PSTREAM_WINDOW_START_REG 0x81F0 +#define PSTREAM_WINDOW_SIZE_REG 0x81F4 +#define SSTREAM_WINDOW_START_REG 0x81F8 +#define SSTREAM_WINDOW_SIZE_REG 0x81FC +#define PSTREAM_FBSIZE_REG 0x8300 +#define SSTREAM_FBSIZE_REG 0x8304 +#define SSTREAM_FBADDR2_REG 0x8308 + +#define OS_XY(x,y) (((x+1)<<16)|(y+1)) +#define OS_WH(x,y) (((x-1)<<16)|(y)) static unsigned int GetBlendForFourCC( int id ) { switch( id ) { case FOURCC_YUY2: - case FOURCC_UYVY: case FOURCC_YV12: case FOURCC_I420: - return 1 << 9; + return 1; case FOURCC_Y211: - return 4 << 9; + return 4; case FOURCC_RV15: - return 3 << 9; + return 3; case FOURCC_RV16: - return 5 << 9; + return 5; default: return 0; } } -void SavageInitStreams(ScrnInfoPtr pScrn) +void myOUTREG( SavagePtr psav, unsigned long offset, unsigned long value ) +{ + ErrorF( "MMIO %04x, was %08x, want %08x,", + offset, MMIO_IN32( psav->MapBase, offset ), value ); + MMIO_OUT32( psav->MapBase, offset, value ); + ErrorF( " now %08x\n", MMIO_IN32( psav->MapBase, offset ) ); +} + +void SavageInitStreamsOld(ScrnInfoPtr pScrn) { SavagePtr psav = SAVPTR(pScrn); unsigned long jDelta; + unsigned long format = 0; -#ifdef XVTRACE - ErrorF( "SavageInitStreams\n" ); -#endif + /* + * For the OLD streams engine, several of these registers + * cannot be touched unless streams are on. Seems backwards to me; + * I'd want to set 'em up, then cut 'em loose. + */ + + xf86ErrorFVerb(XVTRACE, "SavageInitStreams\n" ); + + /* Primary stream reflects the frame buffer. */ + + switch( pScrn->depth ) { + case 8: format = 0 << 24; break; + case 15: format = 3 << 24; break; + case 16: format = 5 << 24; break; + case 24: format = 7 << 24; break; + } + + jDelta = pScrn->displayWidth * pScrn->bitsPerPixel / 8; + OUTREG( PSTREAM_WINDOW_START_REG, OS_XY(0,0) ); + OUTREG( PSTREAM_WINDOW_SIZE_REG, OS_WH(pScrn->displayWidth, pScrn->virtualY) ); + OUTREG( PSTREAM_FBADDR0_REG, pScrn->fbOffset ); + OUTREG( PSTREAM_FBADDR1_REG, 0 ); + OUTREG( PSTREAM_STRIDE_REG, jDelta ); + OUTREG( PSTREAM_CONTROL_REG, format ); + OUTREG( PSTREAM_FBSIZE_REG, jDelta * pScrn->virtualY >> 3 ); + + OUTREG( COL_CHROMA_KEY_CONTROL_REG, 0 ); + OUTREG( SSTREAM_CONTROL_REG, 0 ); + OUTREG( CHROMA_KEY_UPPER_BOUND_REG, 0 ); + OUTREG( SSTREAM_STRETCH_REG, 0 ); + OUTREG( COLOR_ADJUSTMENT_REG, 0 ); + OUTREG( BLEND_CONTROL_REG, 1 << 24 ); + OUTREG( DOUBLE_BUFFER_REG, 0 ); + OUTREG( SSTREAM_FBADDR0_REG, 0 ); + OUTREG( SSTREAM_FBADDR1_REG, 0 ); + OUTREG( SSTREAM_FBADDR2_REG, 0 ); +/* OUTREG( SSTREAM_FBSIZE_REG, 0 ); */ + OUTREG( SSTREAM_STRIDE_REG, 0 ); + OUTREG( SSTREAM_VSCALE_REG, 0 ); + OUTREG( SSTREAM_LINES_REG, 0 ); + OUTREG( SSTREAM_VINITIAL_REG, 0 ); + OUTREG( SSTREAM_WINDOW_START_REG, OS_XY(0xfffe, 0xfffe) ); + OUTREG( SSTREAM_WINDOW_SIZE_REG, OS_WH(10,2) ); +} + +#undef OUTREG +#define OUTREG(a,v) myOUTREG(psav,a,v) +#undef OUTREG +#define OUTREG(addr,val) MMIO_OUT32(psav->MapBase, addr, val) + +void SavageInitStreamsNew(ScrnInfoPtr pScrn) +{ + SavagePtr psav = SAVPTR(pScrn); + unsigned long jDelta; + + xf86ErrorFVerb(XVTRACE, "SavageInitStreams\n" ); /* Primary stream reflects the frame buffer. */ @@ -238,8 +381,6 @@ void SavageInitStreams(ScrnInfoPtr pScrn) OUTREG( SEC_STREAM_COLOR_CONVERT1, 0x0000C892 ); OUTREG( SEC_STREAM_COLOR_CONVERT2, 0x00039F9A ); OUTREG( SEC_STREAM_COLOR_CONVERT3, 0x01F1547E ); - - /* Wait for VBLANK. */ } void SavageStreamsOn(ScrnInfoPtr pScrn, int id) @@ -249,9 +390,7 @@ void SavageStreamsOn(ScrnInfoPtr pScrn, int id) unsigned char jStreamsControl; unsigned short vgaIOBase, vgaCRIndex, vgaCRReg; -#ifdef XVTRACE - ErrorF( "SavageStreamsOn\n" ); -#endif + xf86ErrorFVerb(XVTRACE, "SavageStreamsOn\n" ); /* Sequence stolen from streams.c in M7 NT driver */ @@ -271,26 +410,43 @@ void SavageStreamsOn(ScrnInfoPtr pScrn, int id) VGAOUT16(0x3c4, 0x0608); VGAOUT8( vgaCRIndex, EXT_MISC_CTRL2 ); - jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAM1; - /* Wait for VBLANK. */ - - VerticalRetraceWait(); + if( (psav->Chipset == S3_SAVAGE_MX) || + (psav->Chipset == S3_SAVAGE2000) ) + { + jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAM1; - /* Fire up streams! */ + /* Wait for VBLANK. */ + + VerticalRetraceWait(); - VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 ); + /* Fire up streams! */ - psav->blendBase = GetBlendForFourCC( id ); -#ifdef XVTRACE - ErrorF("Format %4.4s, blend is %08x\n", &id, psav->blendBase ); -#endif - OUTREG( BLEND_CONTROL, psav->blendBase | 0x08 ); + VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 ); - /* These values specify brightness, contrast, saturation and hue. */ - OUTREG( SEC_STREAM_COLOR_CONVERT1, 0x0000C892 ); - OUTREG( SEC_STREAM_COLOR_CONVERT2, 0x00039F9A ); - OUTREG( SEC_STREAM_COLOR_CONVERT3, 0x01F1547E ); + psav->blendBase = GetBlendForFourCC( id ) << 9; + xf86ErrorFVerb(XVTRACE+1,"Format %4.4s, blend is %08x\n", &id, psav->blendBase ); + OUTREG( BLEND_CONTROL, psav->blendBase | 0x08 ); + + /* These values specify brightness, contrast, saturation and hue. */ + OUTREG( SEC_STREAM_COLOR_CONVERT1, 0x0000C892 ); + OUTREG( SEC_STREAM_COLOR_CONVERT2, 0x00039F9A ); + OUTREG( SEC_STREAM_COLOR_CONVERT3, 0x01F1547E ); + } + else + { + jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAMS_OLD; + + /* Wait for VBLANK. */ + + VerticalRetraceWait(); + + /* Fire up streams! */ + + VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 ); + + SavageInitStreamsOld( pScrn ); + } /* Wait for VBLANK. */ @@ -312,9 +468,7 @@ void SavageStreamsOff(ScrnInfoPtr pScrn) unsigned char jStreamsControl; unsigned short vgaIOBase, vgaCRIndex, vgaCRReg; -#ifdef XVTRACE - ErrorF( "SavageStreamsOff\n" ); -#endif + xf86ErrorFVerb(XVTRACE, "SavageStreamsOff\n" ); hwp = VGAHWPTR(pScrn); @@ -332,7 +486,11 @@ void SavageStreamsOff(ScrnInfoPtr pScrn) VGAOUT16(0x3c4, 0x0608); VGAOUT8( vgaCRIndex, EXT_MISC_CTRL2 ); - jStreamsControl = VGAIN8( vgaCRReg ) & NO_STREAMS; + if( (psav->Chipset == S3_SAVAGE_MX) || + (psav->Chipset == S3_SAVAGE2000) ) + jStreamsControl = VGAIN8( vgaCRReg ) & NO_STREAMS; + else + jStreamsControl = VGAIN8( vgaCRReg ) & NO_STREAMS_OLD; /* Wait for VBLANK. */ @@ -342,6 +500,10 @@ void SavageStreamsOff(ScrnInfoPtr pScrn) VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 ); + VGAOUT16( vgaCRIndex, 0x0093 ); + VGAOUT8( vgaCRIndex, 0x92 ); + VGAOUT8( vgaCRReg, VGAIN8(vgaCRReg) & 0x40 ); + psav->videoFlags &= ~VF_STREAMS_ON; } @@ -354,14 +516,31 @@ void SavageInitVideo(ScreenPtr pScreen) SavagePtr psav = SAVPTR(pScrn); int num_adaptors; -#ifdef XVTRACE - ErrorF("SavageInitVideo\n"); -#endif + xf86ErrorFVerb(XVTRACE,"SavageInitVideo\n"); +xf86Break1(); + if( + (psav->Chipset == S3_SAVAGE_MX) || + (psav->Chipset == S3_SAVAGE2000) + ) + { + newAdaptor = SavageSetupImageVideo(pScreen); + SavageInitOffscreenImages(pScreen); - if( psav->Chipset == S3_SAVAGE_MX ) + SavageInitStreams = SavageInitStreamsNew; + SavageSetColor = SavageSetColorNew; + SavageSetColorKey = SavageSetColorKeyNew; + SavageDisplayVideo = SavageDisplayVideoNew; + } + else { newAdaptor = SavageSetupImageVideo(pScreen); SavageInitOffscreenImages(pScreen); + /*DELETENEXTLINE*/ + /* Since newAdaptor is still NULL, these are still disabled for now. */ + SavageInitStreams = SavageInitStreamsOld; + SavageSetColor = SavageSetColorOld; + SavageSetColorKey = SavageSetColorKeyOld; + SavageDisplayVideo = SavageDisplayVideoOld; } num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); @@ -389,12 +568,67 @@ void SavageInitVideo(ScreenPtr pScreen) if(newAdaptors) xfree(newAdaptors); - if( psav->Chipset == S3_SAVAGE_MX ) - SavageInitStreams(pScrn); + if( newAdaptor ) + { + if( SavageInitStreams == SavageInitStreamsNew ) + SavageInitStreams(pScrn); + psav->videoFlags = 0; + psav->videoFourCC = 0; + } } -void SavageSetColorKey(ScrnInfoPtr pScrn) +void SavageSetColorKeyOld(ScrnInfoPtr pScrn) +{ + SavagePtr psav = SAVPTR(pScrn); + SavagePortPrivPtr pPriv = psav->adaptor->pPortPrivates[0].ptr; + int red, green, blue; + + /* Here, we reset the colorkey and all the controls. */ + + red = (pPriv->colorKey & pScrn->mask.red) >> pScrn->offset.red; + green = (pPriv->colorKey & pScrn->mask.green) >> pScrn->offset.green; + blue = (pPriv->colorKey & pScrn->mask.blue) >> pScrn->offset.blue; + + if( !pPriv->colorKey ) { + OUTREG( COL_CHROMA_KEY_CONTROL_REG, 0 ); + OUTREG( CHROMA_KEY_UPPER_BOUND_REG, 0 ); + OUTREG( BLEND_CONTROL_REG, 0 ); + } + else { + switch (pScrn->depth) { + case 8: + OUTREG( COL_CHROMA_KEY_CONTROL_REG, + 0x37000000 | (pPriv->colorKey & 0xFF) ); + OUTREG( CHROMA_KEY_UPPER_BOUND_REG, + 0x00000000 | (pPriv->colorKey & 0xFF) ); + break; + case 15: + OUTREG( COL_CHROMA_KEY_CONTROL_REG, + 0x05000000 | (red<<19) | (green<<11) | (blue<<3) ); + OUTREG( CHROMA_KEY_UPPER_BOUND_REG, + 0x00000000 | (red<<19) | (green<<11) | (blue<<3) ); + break; + case 16: + OUTREG( COL_CHROMA_KEY_CONTROL_REG, + 0x16000000 | (red<<19) | (green<<10) | (blue<<3) ); + OUTREG( CHROMA_KEY_UPPER_BOUND_REG, + 0x00020002 | (red<<19) | (green<<10) | (blue<<3) ); + break; + case 24: + OUTREG( COL_CHROMA_KEY_CONTROL_REG, + 0x17000000 | (red<<16) | (green<<8) | (blue) ); + OUTREG( CHROMA_KEY_UPPER_BOUND_REG, + 0x00000000 | (red<<16) | (green<<8) | (blue) ); + break; + } + + /* We use destination colorkey */ + OUTREG( BLEND_CONTROL_REG, 0x05000000 ); + } +} + +void SavageSetColorKeyNew(ScrnInfoPtr pScrn) { SavagePtr psav = SAVPTR(pScrn); SavagePortPrivPtr pPriv = psav->adaptor->pPortPrivates[0].ptr; @@ -445,7 +679,41 @@ void SavageSetColorKey(ScrnInfoPtr pScrn) } -void SavageSetColor( ScrnInfoPtr pScrn ) +void SavageSetColorOld( ScrnInfoPtr pScrn ) +{ + SavagePtr psav = SAVPTR(pScrn); + SavagePortPrivPtr pPriv = psav->adaptor->pPortPrivates[0].ptr; + + xf86ErrorFVerb(XVTRACE, "bright %d, contrast %d, saturation %d, hue %d\n", + pPriv->brightness, pPriv->contrast, pPriv->saturation, pPriv->hue ); + + if( + (psav->videoFourCC == FOURCC_RV15) || + (psav->videoFourCC == FOURCC_RV16) + ) + { + OUTREG( COLOR_ADJUSTMENT_REG, 0 ); + } + else + { + /* Change 0..255 into 0..15 */ + long sat = pPriv->saturation * 16 / 256; + double hue = pPriv->hue * 0.017453292; + unsigned long hs1 = ((long)(sat * cos(hue))) & 0x1f; + unsigned long hs2 = ((long)(sat * sin(hue))) & 0x1f; + + OUTREG( COLOR_ADJUSTMENT_REG, + 0x80008000 | + (pPriv->brightness + 128) | + ((pPriv->contrast & 0xf8) << (12-7)) | + (hs1 << 16) | + (hs2 << 24) + ); + + } +} + +void SavageSetColorNew( ScrnInfoPtr pScrn ) { SavagePtr psav = SAVPTR(pScrn); SavagePortPrivPtr pPriv = psav->adaptor->pPortPrivates[0].ptr; @@ -458,10 +726,8 @@ void SavageSetColor( ScrnInfoPtr pScrn ) double h = pPriv->hue * 0.017453292; unsigned long assembly; -#ifdef XVTRACE1 - ErrorF( "bright %d, contrast %d, saturation %d, hue %d\n", + xf86ErrorFVerb(XVTRACE, "bright %d, contrast %d, saturation %d, hue %d\n", pPriv->brightness, pPriv->contrast, pPriv->saturation, pPriv->hue ); -#endif if( psav->videoFourCC == FOURCC_Y211 ) k = 1.0; /* YUV */ @@ -489,35 +755,29 @@ void SavageSetColor( ScrnInfoPtr pScrn ) k2 = (int)(dk2+0.5) & 0x1ff; k3 = (int)(dk3+0.5) & 0x1ff; assembly = (k3<<18) | (k2<<9) | k1; -#ifdef XVTRACE1 - ErrorF( "CC1 = %08x ", assembly ); -#endif + xf86ErrorFVerb(XVTRACE+1, "CC1 = %08x ", assembly ); OUTREG( SEC_STREAM_COLOR_CONVERT1, assembly ); + k4 = (int)(dk4+0.5) & 0x1ff; k5 = (int)(dk5+0.5) & 0x1ff; k6 = (int)(dk6+0.5) & 0x1ff; assembly = (k6<<18) | (k5<<9) | k4; -#ifdef XVTRACE1 - ErrorF( "CC2 = %08x ", assembly ); -#endif + xf86ErrorFVerb(XVTRACE+1, "CC2 = %08x ", assembly ); OUTREG( SEC_STREAM_COLOR_CONVERT2, assembly ); + k7 = (int)(dk7+0.5) & 0x1ff; kb = (int)(dkb+0.5) & 0xffff; assembly = (kb<<9) | k7; -#ifdef XVTRACE1 - ErrorF( "CC3 = %08x\n", assembly ); -#endif + xf86ErrorFVerb(XVTRACE+1, "CC3 = %08x\n", assembly ); OUTREG( SEC_STREAM_COLOR_CONVERT3, assembly ); } void SavageResetVideo(ScrnInfoPtr pScrn) { -#ifdef XVTRACE - ErrorF("SavageResetVideo\n"); -#endif - SavageSetColorKey( pScrn ); + xf86ErrorFVerb(XVTRACE,"SavageResetVideo\n"); SavageSetColor( pScrn ); + SavageSetColorKey( pScrn ); } @@ -529,9 +789,7 @@ SavageSetupImageVideo(ScreenPtr pScreen) XF86VideoAdaptorPtr adapt; SavagePortPrivPtr pPriv; -#ifdef XVTRACE - ErrorF("SavageSetupImageVideo\n"); -#endif + xf86ErrorFVerb(XVTRACE,"SavageSetupImageVideo\n"); if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + sizeof(SavagePortPrivRec) + @@ -579,6 +837,7 @@ SavageSetupImageVideo(ScreenPtr pScreen) pPriv->contrast = 128; pPriv->saturation = 128; pPriv->hue = 0; + pPriv->lastKnownPitch = 0; /* gotta uninit this someplace */ REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); @@ -704,9 +963,7 @@ SavageStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) SavagePortPrivPtr pPriv = (SavagePortPrivPtr)data; /*SavagePtr psav = SAVPTR(pScrn); */ -#ifdef XVTRACE - ErrorF("SavageStopVideo\n"); -#endif + xf86ErrorFVerb(XVTRACE,"SavageStopVideo\n"); REGION_EMPTY(pScrn->pScreen, &pPriv->clip); @@ -917,7 +1174,7 @@ SavageAllocateMemory( } static void -SavageDisplayVideo( +SavageDisplayVideoOld( ScrnInfoPtr pScrn, int id, int offset, @@ -930,6 +1187,7 @@ SavageDisplayVideo( ){ SavagePtr psav = SAVPTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); + SavagePortPrivPtr pPriv = psav->adaptor->pPortPrivates[0].ptr; /*DisplayModePtr mode = pScrn->currentMode;*/ int vgaCRIndex, vgaCRReg, vgaIOBase; @@ -947,23 +1205,115 @@ SavageDisplayVideo( SavageResetVideo(pScrn); } + /* Set surface format. */ + + OUTREG(SSTREAM_CONTROL_REG, + (GetBlendForFourCC(psav->videoFourCC) << 24) + src_w ); + /* Calculate horizontal scale factor. */ - OUTREG(SEC_STREAM_HSCALING, - ((src_w&0xfff)<<20) | ((65536 * src_w / drw_w) & 0x1FFFF )); + OUTREG(SSTREAM_STRETCH_REG, 32768 * src_w / drw_w ); /* Calculate vertical scale factor. */ - /* BUGBUG need to add 00040000 if src stride > 2048 */ - OUTREG(SEC_STREAM_VSCALING, - ((src_h&0xfff)<<20) | ((65536 * src_h / drw_h) & 0x1FFFF )); + OUTREG(SSTREAM_LINES_REG, src_h ); + OUTREG(SSTREAM_VINITIAL_REG, 0 ); + OUTREG(SSTREAM_VSCALE_REG, 32768 * src_h / drw_h ); /* Set surface location and stride. */ + OUTREG(SSTREAM_FBADDR0_REG, (offset + (x1>>15)) & 0x3ffff0 ); + OUTREG(SSTREAM_STRIDE_REG, pitch & 0xfff ); + + OUTREG(SSTREAM_WINDOW_START_REG, OS_XY(dstBox->x1, dstBox->y1) ); + OUTREG(SSTREAM_WINDOW_SIZE_REG, OS_WH(drw_w, drw_h) ); + + /* Set color key on primary. */ + + SavageSetColorKey( pScrn ); + + /* Set FIFO L2 on second stream. */ + + if( pPriv->lastKnownPitch != pitch ) + { + unsigned char cr92; + + pPriv->lastKnownPitch = pitch; + + pitch = (pitch + 7) / 8; + VGAOUT8(vgaCRIndex, 0x92); + cr92 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, (cr92 & 0x40) | (pitch >> 8) | 0x80); + VGAOUT8(vgaCRIndex, 0x93); + VGAOUT8(vgaCRReg, pitch); + } + +} + +static void +SavageDisplayVideoNew( + ScrnInfoPtr pScrn, + int id, + int offset, + short width, short height, + int pitch, + int x1, int y1, int x2, int y2, + BoxPtr dstBox, + short src_w, short src_h, + short drw_w, short drw_h +){ + SavagePtr psav = SAVPTR(pScrn); + vgaHWPtr hwp = VGAHWPTR(pScrn); + /*DisplayModePtr mode = pScrn->currentMode;*/ + SavagePortPrivPtr pPriv = psav->adaptor->pPortPrivates[0].ptr; + int vgaCRIndex, vgaCRReg, vgaIOBase; + + + vgaIOBase = hwp->IOBase; + vgaCRIndex = vgaIOBase + 4; + vgaCRReg = vgaIOBase + 5; + + if( psav->videoFourCC != id ) + SavageStreamsOff(pScrn); + + if( !psav->videoFlags & VF_STREAMS_ON ) + { + SavageStreamsOn(pScrn, id); + SavageResetVideo(pScrn); + } + + /* Calculate horizontal and vertical scale factors. */ + + if( psav->Chipset == S3_SAVAGE2000 ) + { + OUTREG(SEC_STREAM_HSCALING, + (65536 * src_w / drw_w) & 0x1FFFFF ); + if( src_w < drw_w ) + OUTREG(SEC_STREAM_HSCALE_NORMALIZE, + ((2048 * src_w / drw_w) & 0x7ff) << 16 ); + else + OUTREG(SEC_STREAM_HSCALE_NORMALIZE, 2048 << 16 ); + OUTREG(SEC_STREAM_VSCALING, + (65536 * src_h / drw_h) & 0x1FFFFF ); + } + else + { + OUTREG(SEC_STREAM_HSCALING, + ((src_w&0xfff)<<20) | ((65536 * src_w / drw_w) & 0x1FFFF )); + /* BUGBUG need to add 00040000 if src stride > 2048 */ + OUTREG(SEC_STREAM_VSCALING, + ((src_h&0xfff)<<20) | ((65536 * src_h / drw_h) & 0x1FFFF )); + } + + /* + * Set surface location and stride. We use x1>>15 because all surfaces + * are 2 bytes/pixel. + */ + OUTREG(SEC_STREAM_FBUF_ADDR0, (offset + (x1>>15)) & 0x3ffff0 ); OUTREG(SEC_STREAM_STRIDE, pitch & 0xfff ); - OUTREG(SEC_STREAM_WINDOW_START, ((dstBox->x1) << 16) | dstBox->y1 ); - OUTREG(SEC_STREAM_WINDOW_SZ, (drw_w << 16) | drw_h ); + OUTREG(SEC_STREAM_WINDOW_START, ((dstBox->x1+1) << 16) | (dstBox->y1+1) ); + OUTREG(SEC_STREAM_WINDOW_SZ, ((drw_w) << 16) | drw_h ); /* Set color key on primary. */ @@ -971,12 +1321,18 @@ SavageDisplayVideo( /* Set FIFO L2 on second stream. */ - pitch = (pitch + 7) / 8 - 4; - VGAOUT8(vgaCRIndex, 0x92); - VGAOUT8(vgaCRReg, (pitch >> 8) | 0x80); - VGAOUT8(vgaCRIndex, 0x93); - VGAOUT8(vgaCRReg, pitch); - + if( pPriv->lastKnownPitch != pitch ) + { + unsigned char cr92; + + pPriv->lastKnownPitch = pitch; + pitch = (pitch + 7) / 8 - 4; + VGAOUT8(vgaCRIndex, 0x92); + cr92 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, (cr92 & 0x40) | (pitch >> 8) | 0x80); + VGAOUT8(vgaCRIndex, 0x93); + VGAOUT8(vgaCRReg, pitch); + } } static int @@ -1049,7 +1405,6 @@ SavagePutImage( case FOURCC_RV15: /* RGB15 */ case FOURCC_RV16: /* RGB16 */ case FOURCC_YUY2: /* YUY2 */ - case FOURCC_UYVY: /* YUY2 */ default: srcPitch = (width << 1); break; @@ -1147,7 +1502,6 @@ SavageQueryImageAttributes( case FOURCC_RV15: /* RGB15 */ case FOURCC_RV16: /* RGB16 */ case FOURCC_YUY2: - case FOURCC_UYVY: default: size = *w << 1; if(pitches) pitches[0] = size; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile index e97a2e22f..5c53c6289 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile,v 1.23 2001/01/24 00:06:27 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile,v 1.24 2001/04/19 12:40:33 alanh Exp $ XCOMM XCOMM This is an Imakefile for the SIS driver. XCOMM @@ -15,18 +15,20 @@ DRIDEFINES = $(GLX_DEFINES) #endif SRCS = sis_driver.c sis_dac.c sis_cursor.c sis_accel.c sis_setup.c\ - sis530_accel.c sis300_accel.c sis_vga.c sis_vb.c sis_video.c\ - sis_opt.c init300.c init301.c sis_dga.c $(DRISRCS) + sis530_accel.c sis300_accel.c sis_vga.c sis_vb.c\ + sis_opt.c sis_dga.c sis_video.c sis_bios.c sis_shadow.c \ + $(DRISRCS) OBJS = sis_driver.o sis_dac.o sis_cursor.o sis_accel.o sis_setup.o\ - sis530_accel.o sis300_accel.o sis_vga.o sis_vb.o sis_video.o\ - sis_opt.o init300.o init301.o sis_dga.o $(DRIOBJS) + sis530_accel.o sis300_accel.o sis_vga.o sis_vb.o\ + sis_opt.o sis_dga.o sis_video.o sis_bios.o sis_shadow.o \ + $(DRIOBJS) #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include #else INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(SERVERSRC)/Xext \ -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ - -I$(SERVERSRC)/fb -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa \ + -I$(SERVERSRC)/fb -I$(XF86SRC)/xaa \ -I$(XF86SRC)/xf1bpp -I$(XF86SRC)/xf4bpp \ -I$(XF86SRC)/xf24_32bpp \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \ @@ -34,8 +36,9 @@ INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(SERVERSRC)/Xext \ -I$(XF86SRC)/rac \ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(XTOP)/include/extensions \ - -I$(SERVERSRC)/render \ - $(DRIINCLUDES) + -I$(SERVERSRC)/render \ + -I$(XF86SRC)/shadowfb \ + $(DRIINCLUDES) #endif DEFINES = $(DRIDEFINES) @@ -56,26 +59,31 @@ InstallModuleManPage(sis) DependTarget() - InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/sis) -InstallDriverSDKNonExecFile(init300.c,$(DRIVERSDKDIR)/drivers/sis) -InstallDriverSDKNonExecFile(init301.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis300_accel.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis300_accel.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis530_accel.c,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(sis530_accel.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_accel.c,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(sis_bios.c,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(sis_bios.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_cursor.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_cursor.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_dac.c,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(sis_dac.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_dga.c,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(sis_dri.c,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(sis_dri.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_driver.c,$(DRIVERSDKDIR)/drivers/sis) -InstallDriverSDKNonExecFile(sis_driver.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_opt.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_regs.h,$(DRIVERSDKDIR)/drivers/sis) -InstallDriverSDKNonExecFile(sis_regs2.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_setup.c,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(sis_shadow.c,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(sis_shadow.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_vb.c,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(sis_vb.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_vga.c,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(sis_video.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKObjectModule(sis,$(DRIVERSDKMODULEDIR),drivers) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h index 17656cd80..da25bfba9 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h @@ -25,15 +25,15 @@ * Mitani Hiroshi <hmitani@drl.mei.co.jp> * David Thomas <davtom@dream.org.uk>. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.19 2000/12/02 01:16:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.20 2001/04/19 12:40:33 alanh Exp $ */ #ifndef _SIS_H #define _SIS_H_ - #include "xf86Pci.h" #include "xf86Cursor.h" #include "xf86_ansic.h" +#include "xf86xv.h" #include "compiler.h" #include "xaa.h" #include "vgaHW.h" @@ -48,7 +48,6 @@ #include "sis_dri.h" #endif -#include "xf86xv.h" #define SIS_NAME "SIS" #define SIS_DRIVER_NAME "sis" @@ -85,14 +84,13 @@ #define TV_INTERFACE 0x00070000 #define VB_301 0x00100000 #define VB_302 0x00200000 -#define VB_303 0x00400000 +#define VB_303 0x00400000 #define VB_LVDS 0x01000000 #define VB_CHRONTEL 0x02000000 #define SINGLE_MODE 0x00000000 #define SIMU_MODE 0x10000000 #define MM_MODE 0x20000000 #define DISPLAY_MODE 0x30000000 - #define MASK_DISPTYPE_CRT2 0x04 /* Connect LCD */ #define MASK_DISPTYPE_LCD 0x02 /* Connect LCD */ #define MASK_DISPTYPE_TV 0x01 /* Connect TV */ @@ -112,7 +110,7 @@ typedef struct { unsigned char VBPart2[0x46]; unsigned char VBPart3[0x3F]; unsigned char VBPart4[0x1C]; - unsigned short ch7005[0x11]; + unsigned short ch7005[0x11]; } SISRegRec, *SISRegPtr; #define SISPTR(p) ((SISPtr)((p)->driverPrivate)) @@ -125,20 +123,21 @@ typedef struct { EntityInfoPtr pEnt; int Chipset; int ChipRev; - unsigned long FbAddress; /* VRAM physical address */ - unsigned char * FbBase; /* VRAM linear address */ - CARD32 IOAddress; /* MMIO physical address */ - unsigned char * IOBase; /* MMIO linear address */ + unsigned long FbAddress; /* VRAM physical address */ + + unsigned char * FbBase; /* VRAM linear address */ + CARD32 IOAddress; /* MMIO physical address */ + unsigned char * IOBase; /* MMIO linear address */ #ifdef __alpha__ - unsigned char * IOBaseDense; /* MMIO for Alpha platform */ + unsigned char * IOBaseDense; /* MMIO for Alpha platform */ #endif - CARD16 RelIO; /* Relocate IO Base */ + CARD16 RelIO; /* Relocate IO Base */ unsigned char * BIOS; int MemClock; int BusWidth; int MinClock; int MaxClock; - int Flags; /* HW config flags */ + int Flags; /* HW config flags */ long FbMapSize; DGAModePtr DGAModes; int numDGAModes; @@ -148,7 +147,7 @@ typedef struct { Bool HWCursor; Bool UsePCIRetry; Bool TurboQueue; - int ForceCRT2Type; + int ForceCRT2Type; Bool ValidWidth; Bool FastVram; int VBFlags; @@ -174,96 +173,62 @@ typedef struct { XAAInfoRecPtr AccelInfoPtr; CloseScreenProcPtr CloseScreen; unsigned int (*ddc1Read)(ScrnInfoPtr); - Bool (*ModeInit)(ScrnInfoPtr pScrn, DisplayModePtr mode); - void (*SiSSave)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSSave2)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSSaveLVDS)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSSaveChrontel)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSRestore)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSRestore2)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSRestoreLVDS)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SiSRestoreChrontel)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SetThreshold)(ScrnInfoPtr pScrn, DisplayModePtr mode, + Bool (*ModeInit)(ScrnInfoPtr pScrn, DisplayModePtr mode); + void (*SiSSave)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSSave2)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSSaveLVDS)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSSaveChrontel)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSRestore)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSRestore2)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSRestoreLVDS)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SiSRestoreChrontel)(ScrnInfoPtr pScrn, SISRegPtr sisreg); + void (*SetThreshold)(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned short *Low, unsigned short *High); - void (*LoadCRT2Palette)(ScrnInfoPtr pScrn, int numColors, - int *indicies, LOCO *colors, VisualPtr pVisual); + void (*LoadCRT2Palette)(ScrnInfoPtr pScrn, int numColors, + int *indicies, LOCO *colors, VisualPtr pVisual); + + int *cmdQueueLenPtr; + unsigned long agpHandle; + CARD32 agpAddr; + unsigned char *agpBase; + unsigned int agpSize; + CARD32 agpCmdBufAddr; + unsigned char *agpCmdBufBase; + unsigned int agpCmdBufSize; + unsigned int agpCmdBufFree; + Bool irqEnabled; + int irq; + int ColorExpandRingHead; + int ColorExpandRingTail; + int PerColorExpandBufferSize; + int ColorExpandBufferNumber; + int ColorExpandBufferCountMask; + unsigned char *ColorExpandBufferAddr[32]; + int ColorExpandBufferScreenOffset[32]; + int ImageWriteBufferSize; + unsigned char *ImageWriteBufferAddr; + + int Rotate; + void (*PointerMoved)(int index, int x, int y); + + /* ShadowFB support */ + Bool ShadowFB; + unsigned char *ShadowPtr; + int ShadowPitch; + - int *cmdQueueLenPtr; - unsigned long agpHandle; - CARD32 agpAddr; - unsigned char *agpBase; - unsigned int agpSize; - CARD32 agpCmdBufAddr; - unsigned char *agpCmdBufBase; - unsigned int agpCmdBufSize; - unsigned int agpCmdBufFree; - Bool irqEnabled; - int irq; - int ColorExpandRingHead; - int ColorExpandRingTail; - int PerColorExpandBufferSize; - int ColorExpandBufferNumber; - int ColorExpandBufferCountMask; - unsigned char *ColorExpandBufferAddr[32]; - int ColorExpandBufferScreenOffset[32]; - int ImageWriteBufferSize; - unsigned char *ImageWriteBufferAddr; - #ifdef XF86DRI - Bool directRenderingEnabled; - DRIInfoPtr pDRIInfo; - int drmSubFD; - int numVisualConfigs; - __GLXvisualConfig* pVisualConfigs; - SISConfigPrivPtr pVisualConfigsPriv; - SISRegRec DRContextRegs; + Bool directRenderingEnabled; + DRIInfoPtr pDRIInfo; + int drmSubFD; + int numVisualConfigs; + __GLXvisualConfig* pVisualConfigs; + SISConfigPrivPtr pVisualConfigsPriv; + SISRegRec DRContextRegs; #endif + XF86VideoAdaptorPtr adaptor; + ScreenBlockHandlerProcPtr BlockHandler; - XF86VideoAdaptorPtr adaptor; - ScreenBlockHandlerProcPtr BlockHandler; } SISRec, *SISPtr; -/* Prototypes */ - -void SiSOptions(ScrnInfoPtr pScrn); -void SISVGAPreInit(ScrnInfoPtr pScrn); -void SISLCDPreInit(ScrnInfoPtr pScrn); -void SISTVPreInit(ScrnInfoPtr pScrn); -void SISCRT2PreInit(ScrnInfoPtr pScrn); -OptionInfoPtr SISAvailableOptions(int chipid, int busid); - -void SISDACPreInit(ScrnInfoPtr pScrn); -void SISLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, - LOCO *colors, VisualPtr pVisual); - -int compute_vclk(int Clock, int *out_n, int *out_dn, int *out_div, - int *out_sbit, int *out_scale); -void SiSCalcClock(ScrnInfoPtr pScrn, int clock, int max_VLD, - unsigned int *vclk); -unsigned int SiSddc1Read(ScrnInfoPtr pScrn); -Bool SiSAccelInit(ScreenPtr pScreen); -Bool SiS530AccelInit(ScreenPtr pScreen); -Bool SiS300AccelInit(ScreenPtr pScreen); -int SiSMclk(SISPtr pSIS); -int sisMemBandWidth(ScrnInfoPtr pScrn); -int sis300MemBandWidth(ScrnInfoPtr pScrn); -Bool SiSHWCursorInit(ScreenPtr pScreen); -void SiSIODump(ScrnInfoPtr pScreen); -void SiSInitializeAccelerator(ScrnInfoPtr pScrn); -void SiSSetup(ScrnInfoPtr pScrn); -void SiSPreSetMode(ScrnInfoPtr pScrn); - -extern void SetReg1(unsigned short, unsigned short, unsigned short); -extern unsigned short GetReg1(unsigned short, unsigned short); - -extern Bool SISSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); -extern void SISAdjustFrame(int scrnIndex, int x, int y, int flags); - -#ifdef XF86DRI -extern void FillPrivateDRI(SISPtr pSIS, SISDRIPtr pSISDRI); -extern Bool SISDRIScreenInit(ScreenPtr pScreen); -extern void SISDRICloseScreen(ScreenPtr pScreen); -Bool SISDRIFinishScreenInit(ScreenPtr pScreen); -#endif - #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man index c029cf0e7..ac66d49fa 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man,v 1.2 2001/01/27 18:20:52 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man,v 1.3 2001/04/19 12:40:33 alanh Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH SIS __drivermansuffix__ __vendorversion__ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c index 821ced5c4..4e656ce1f 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.6 2001/03/03 22:26:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.7 2001/04/19 12:40:33 alanh Exp $ */ /* * @@ -17,17 +17,10 @@ #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" - #include "xf86PciInfo.h" #include "xf86Pci.h" - #include "compiler.h" - -#include "miline.h" - #include "xaa.h" -#include "xaalocal.h" -#include "xf86fbman.h" #include "sis.h" #include "sis300_accel.h" @@ -36,6 +29,8 @@ static void MMIODump(ScrnInfoPtr pScrn); #endif +Bool SiS300AccelInit(ScreenPtr pScreen); +static void SiSInitializeAccelerator(ScrnInfoPtr pScrn); static void SiSSync(ScrnInfoPtr pScrn); static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, @@ -84,188 +79,194 @@ static void SiSSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn, int x, int y, int w, int h, int srcx, int srcy, int skipleft); -static void SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask); -static void SiSSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft); +static void SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, int rop, + unsigned int planemask); +static void SiSSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int x, int y, int w, int h, + int skipleft); static void SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); +static void SiSSetupForImageWrite(ScrnInfoPtr pScrn, int rop, + unsigned int planemask, int trans_color, + int bpp, int depth); +static void SiSSubsequentImageWriteRect(ScrnInfoPtr pScrn, int x, int y, + int w, int h, int skipleft); -static void SiSSetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, int trans_color, int bpp, int depth); -static void SiSSubsequentImageWriteRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft); - -static void SiSSetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, int trans_color, int bpp, int depth) {} -static void SiSSubsequentImageWriteRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft) {} - - -void +static void SiSInitializeAccelerator(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - pSiS->DoColorExpand = FALSE; + pSiS->DoColorExpand = FALSE; } Bool SiS300AccelInit(ScreenPtr pScreen) { - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - SISPtr pSiS = SISPTR(pScrn); - int reservedFbSize; - int UsableFbSize; - unsigned char *AvailBufBase; - BoxRec Avail; - int i, divider; - - pSiS->AccelInfoPtr = infoPtr = XAACreateInfoRec(); - if (!infoPtr) return FALSE; - - SiSInitializeAccelerator(pScrn); - - infoPtr->Flags = LINEAR_FRAMEBUFFER | - OFFSCREEN_PIXMAPS | - PIXMAP_CACHE; - - /* sync */ - infoPtr->Sync = SiSSync; - - if ((pScrn->bitsPerPixel != 8) && (pScrn->bitsPerPixel != 16) && - (pScrn->bitsPerPixel != 32)) return FALSE; - - /* BitBlt */ - infoPtr->SetupForScreenToScreenCopy = SiSSetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = SiSSubsequentScreenToScreenCopy; - infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK | NO_TRANSPARENCY; - - /* solid fills */ - infoPtr->SetupForSolidFill = SiSSetupForSolidFill; - infoPtr->SubsequentSolidFillRect = SiSSubsequentSolidFillRect; - infoPtr->SolidFillFlags = NO_PLANEMASK; - - /* solid line */ - infoPtr->SetupForSolidLine = SiSSetupForSolidLine; - infoPtr->SubsequentSolidTwoPointLine = SiSSubsequentSolidTwoPointLine; - infoPtr->SubsequentSolidHorVertLine = SiSSubsequentSolidHorzVertLine; - infoPtr->SolidFillFlags = NO_PLANEMASK; - - /* dashed line */ - infoPtr->SetupForDashedLine = SiSSetupForDashedLine; - infoPtr->SubsequentDashedTwoPointLine = SiSSubsequentDashedTwoPointLine; - infoPtr->DashPatternMaxLength = 64; - infoPtr->DashedLineFlags = NO_PLANEMASK | - LINE_PATTERN_MSBFIRST_LSBJUSTIFIED; - - /* 8x8 mono pattern fill */ - infoPtr->SetupForMono8x8PatternFill = SiSSetupForMonoPatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = - SiSSubsequentMonoPatternFill; - infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS | - NO_TRANSPARENCY | - BIT_ORDER_IN_BYTE_MSBFIRST ; - -/* 8x8 color pattern fill ---seems not useful by xaa - infoPtr->SetupForColor8x8PatternFill = - SiSSetupForColorPatternFill; - infoPtr->SubsequentColor8x8PatternFillRect = - SiSSubsequentColorPatternFill; - infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS ; -*/ + XAAInfoRecPtr infoPtr; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SISPtr pSiS = SISPTR(pScrn); + int reservedFbSize; + int UsableFbSize; + unsigned char *AvailBufBase; + BoxRec Avail; + int i; + + pSiS->AccelInfoPtr = infoPtr = XAACreateInfoRec(); + if (!infoPtr) + return FALSE; + + SiSInitializeAccelerator(pScrn); + + infoPtr->Flags = LINEAR_FRAMEBUFFER | + OFFSCREEN_PIXMAPS | + PIXMAP_CACHE; + + /* sync */ + infoPtr->Sync = SiSSync; + + if ((pScrn->bitsPerPixel != 8) && (pScrn->bitsPerPixel != 16) && + (pScrn->bitsPerPixel != 32)) return FALSE; + + /* BitBlt */ + infoPtr->SetupForScreenToScreenCopy = SiSSetupForScreenToScreenCopy; + infoPtr->SubsequentScreenToScreenCopy = SiSSubsequentScreenToScreenCopy; + infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK | NO_TRANSPARENCY; + + /* solid fills */ + infoPtr->SetupForSolidFill = SiSSetupForSolidFill; + infoPtr->SubsequentSolidFillRect = SiSSubsequentSolidFillRect; + infoPtr->SolidFillFlags = NO_PLANEMASK; + + /* solid line */ + infoPtr->SetupForSolidLine = SiSSetupForSolidLine; + infoPtr->SubsequentSolidTwoPointLine = SiSSubsequentSolidTwoPointLine; + infoPtr->SubsequentSolidHorVertLine = SiSSubsequentSolidHorzVertLine; + infoPtr->SolidFillFlags = NO_PLANEMASK; + + /* dashed line */ + infoPtr->SetupForDashedLine = SiSSetupForDashedLine; + infoPtr->SubsequentDashedTwoPointLine = SiSSubsequentDashedTwoPointLine; + infoPtr->DashPatternMaxLength = 64; + infoPtr->DashedLineFlags = NO_PLANEMASK | + LINE_PATTERN_MSBFIRST_LSBJUSTIFIED; + + /* 8x8 mono pattern fill */ + infoPtr->SetupForMono8x8PatternFill = SiSSetupForMonoPatternFill; + infoPtr->SubsequentMono8x8PatternFillRect = + SiSSubsequentMonoPatternFill; + infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | + HARDWARE_PATTERN_SCREEN_ORIGIN | + HARDWARE_PATTERN_PROGRAMMED_BITS | + NO_TRANSPARENCY | + BIT_ORDER_IN_BYTE_MSBFIRST ; - /* Screen To Screen Color Expand */ -/* infoPtr->SetupForScreenToScreenColorExpandFill = - SiSSetupForScreenToScreenColorExpand; - infoPtr->SubsequentScreenToScreenColorExpandFill = - SiSSubsequentScreenToScreenColorExpand; -*/ - -/* CPU To Screen Color Expand ---implement another instead of this one! - infoPtr->SetupForCPUToScreenColorExpandFill = - SiSSetupForCPUToScreenColorExpand; - infoPtr->SubsequentCPUToScreenColorExpandFill = - SiSSubsequentCPUToScreenColorExpand; - infoPtr->ColorExpandRange = PATREGSIZE; - infoPtr->ColorExpandBase = pSiS->IOBase+PBR(0); - infoPtr->CPUToScreenColorExpandFillFlags = NO_PLANEMASK | - BIT_ORDER_IN_BYTE_MSBFIRST | - NO_TRANSPARENCY | - SYNC_AFTER_COLOR_EXPAND | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS ; -*/ - -/* per-scanline color expansion*/ - pSiS->ColorExpandBufferNumber = 16; - pSiS->ColorExpandBufferCountMask = 0x0F; - pSiS->PerColorExpandBufferSize = ((pScrn->virtualX + 31)/32) * 4; - infoPtr->NumScanlineColorExpandBuffers = pSiS->ColorExpandBufferNumber; - infoPtr->ScanlineColorExpandBuffers = (unsigned char **)&pSiS->ColorExpandBufferAddr[0]; - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = SiSSetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = SiSSubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = SiSSubsequentColorExpandScanline; - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = - NO_PLANEMASK | - CPU_TRANSFER_PAD_DWORD | - SCANLINE_PAD_DWORD | - BIT_ORDER_IN_BYTE_MSBFIRST | - LEFT_EDGE_CLIPPING; - -/* divider = ((pScrn->virtualX*pScrn->bitsPerPixel)/8)+8; - pSiS->ImageWriteBufferSize = (((12*1024)+divider-1)/divider)*divider; - infoPtr->SetupForImageWrite = SiSSetupForImageWrite; - infoPtr->SubsequentImageWriteRect = SiSSubsequentImageWriteRect; - infoPtr->ImageWriteFlags = CPU_TRANSFER_PAD_DWORD | - SCANLINE_PAD_DWORD | - LEFT_EDGE_CLIPPING | - NO_PLANEMASK| - NO_TRANSPARENCY | - NO_GXCOPY | - SYNC_AFTER_IMAGE_WRITE; -*/ - /* init Frame Buffer Manager */ - reservedFbSize = 0; - if (pSiS->TurboQueue) reservedFbSize += 1024*512; - if (pSiS->HWCursor) reservedFbSize += 4096; - reservedFbSize += (pSiS->ColorExpandBufferNumber * pSiS->PerColorExpandBufferSize); - UsableFbSize = pSiS->FbMapSize - reservedFbSize; - AvailBufBase = pSiS->FbBase + UsableFbSize; - for (i=0; i<pSiS->ColorExpandBufferNumber; i++) - { pSiS->ColorExpandBufferAddr[i] = AvailBufBase + i*pSiS->PerColorExpandBufferSize; - pSiS->ColorExpandBufferScreenOffset[i] = UsableFbSize + i*pSiS->PerColorExpandBufferSize; - } -/* reservedFbSize += pSiS->ImageWriteBufferSize; - UsableFbSize = pSiS->FbMapSize - reservedFbSize; - pSiS->ImageWriteBufferAddr = AvailBufBase = pSiS->FbBase + UsableFbSize; - infoPtr->ImageWriteRange = pSiS->ImageWriteBufferAddr; -*/ - Avail.x1 = 0; - Avail.y1 = 0; - Avail.x2 = pScrn->displayWidth; - Avail.y2 = UsableFbSize / (pScrn->displayWidth * pScrn->bitsPerPixel/8) - 1; - - if (Avail.y2 < 0) Avail.y2 = 32767; +#if 0 + /* 8x8 color pattern fill ---seems not useful by xaa */ + infoPtr->SetupForColor8x8PatternFill = + SiSSetupForColorPatternFill; + infoPtr->SubsequentColor8x8PatternFillRect = + SiSSubsequentColorPatternFill; + infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK | + HARDWARE_PATTERN_SCREEN_ORIGIN | + HARDWARE_PATTERN_PROGRAMMED_BITS ; +#endif - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Frame Buffer From (%d,%d) To (%d,%d)\n", - Avail.x1, Avail.y1, Avail.x2, Avail.y2); +#if 0 + /* Screen To Screen Color Expand */ + infoPtr->SetupForScreenToScreenColorExpandFill = + SiSSetupForScreenToScreenColorExpand; + infoPtr->SubsequentScreenToScreenColorExpandFill = + SiSSubsequentScreenToScreenColorExpand; +#endif + +#if 0 + /* CPU To Screen Color Expand ---implement another instead of this one! */ + infoPtr->SetupForCPUToScreenColorExpandFill = + SiSSetupForCPUToScreenColorExpand; + infoPtr->SubsequentCPUToScreenColorExpandFill = + SiSSubsequentCPUToScreenColorExpand; + infoPtr->ColorExpandRange = PATREGSIZE; + infoPtr->ColorExpandBase = pSiS->IOBase+PBR(0); + infoPtr->CPUToScreenColorExpandFillFlags = NO_PLANEMASK | + BIT_ORDER_IN_BYTE_MSBFIRST | + NO_TRANSPARENCY | + SYNC_AFTER_COLOR_EXPAND | + HARDWARE_PATTERN_SCREEN_ORIGIN | + HARDWARE_PATTERN_PROGRAMMED_BITS ; +#endif - xf86InitFBManager(pScreen, &Avail); + /* per-scanline color expansion*/ + pSiS->ColorExpandBufferNumber = 16; + pSiS->ColorExpandBufferCountMask = 0x0F; + pSiS->PerColorExpandBufferSize = ((pScrn->virtualX + 31)/32) * 4; + infoPtr->NumScanlineColorExpandBuffers = pSiS->ColorExpandBufferNumber; + infoPtr->ScanlineColorExpandBuffers = (unsigned char **)&pSiS->ColorExpandBufferAddr[0]; + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = SiSSetupForScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = SiSSubsequentScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentColorExpandScanline = SiSSubsequentColorExpandScanline; + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + NO_PLANEMASK | + CPU_TRANSFER_PAD_DWORD | + SCANLINE_PAD_DWORD | + BIT_ORDER_IN_BYTE_MSBFIRST | + LEFT_EDGE_CLIPPING; + +#if 0 + divider = ((pScrn->virtualX*pScrn->bitsPerPixel)/8)+8; + pSiS->ImageWriteBufferSize = (((12*1024)+divider-1)/divider)*divider; + infoPtr->SetupForImageWrite = SiSSetupForImageWrite; + infoPtr->SubsequentImageWriteRect = SiSSubsequentImageWriteRect; + infoPtr->ImageWriteFlags = CPU_TRANSFER_PAD_DWORD | + SCANLINE_PAD_DWORD | + LEFT_EDGE_CLIPPING | + NO_PLANEMASK| + NO_TRANSPARENCY | + NO_GXCOPY | + SYNC_AFTER_IMAGE_WRITE; +#endif - return(XAAInit(pScreen, infoPtr)); + /* init Frame Buffer Manager */ + reservedFbSize = 0; + if (pSiS->TurboQueue) reservedFbSize += 1024*512; + if (pSiS->HWCursor) reservedFbSize += 4096; + reservedFbSize += (pSiS->ColorExpandBufferNumber * pSiS->PerColorExpandBufferSize); + UsableFbSize = pSiS->FbMapSize - reservedFbSize; + AvailBufBase = pSiS->FbBase + UsableFbSize; + for (i = 0; i < pSiS->ColorExpandBufferNumber; i++) { + pSiS->ColorExpandBufferAddr[i] = AvailBufBase + + i * pSiS->PerColorExpandBufferSize; + pSiS->ColorExpandBufferScreenOffset[i] = UsableFbSize + + i * pSiS->PerColorExpandBufferSize; + } + + Avail.x1 = 0; + Avail.y1 = 0; + Avail.x2 = pScrn->displayWidth; + Avail.y2 = UsableFbSize / (pScrn->displayWidth * pScrn->bitsPerPixel/8) - 1; + if (Avail.y2 < 0) + Avail.y2 = 32767; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Frame Buffer From (%d,%d) To (%d,%d)\n", + Avail.x1, Avail.y1, Avail.x2, Avail.y2); + + xf86InitFBManager(pScreen, &Avail); + + return(XAAInit(pScreen, infoPtr)); } static void SiSSync(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - PDEBUG(ErrorF("SiSSync()\n")); - pSiS->DoColorExpand = FALSE; - SiSIdle + PDEBUG(ErrorF("SiSSync()\n")); + pSiS->DoColorExpand = FALSE; + SiSIdle } static int sisALUConv[] = @@ -312,199 +313,205 @@ static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, unsigned int planemask, int trans_color) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); /* XAAInfoRecPtr pXAA = XAAPTR(pScrn);*/ - PDEBUG(ErrorF("Setup ScreenCopy(%d, %d, 0x%x, 0x%x, 0x%x)\n", - xdir, ydir, rop, planemask, trans_color)); + PDEBUG(ErrorF("Setup ScreenCopy(%d, %d, 0x%x, 0x%x, 0x%x)\n", + xdir, ydir, rop, planemask, trans_color)); /* - ErrorF("XAAInfoPtr->UsingPixmapCache = %s\n" - "XAAInfoPtr->CanDoMono8x8 = %s\n" - "XAAInfoPtr->CanDoColor8x8 = %s\n" - "XAAInfoPtr->CachePixelGranularity = %d\n" - "XAAInfoPtr->MaxCacheableTileWidth = %d\n" - "XAAInfoPtr->MaxCacheableTileHeight = %d\n" - "XAAInfoPtr->MaxCacheableStippleWidth = %d\n" - "XAAInfoPtr->MaxCacheableStippleHeight = %d\n" - "XAAInfoPtr->MonoPatternPitch = %d\n" - "XAAInfoPtr->CacheWidthMono8x8Pattern = %d\n" - "XAAInfoPtr->CacheHeightMono8x8Pattern = %d\n" - "XAAInfoPtr->ColorPatternPitch = %d\n" - "XAAInfoPtr->CacheWidthColor8x8Pattern = %d\n" - "XAAInfoPtr->CacheHeightColor8x8Pattern = %d\n" - "XAAInfoPtr->CacheColorExpandDensity = %d\n" - "XAAInfoPtr->maxOffPixWidth = %d\n" - "XAAInfoPtr->maxOffPixHeight= %d\n" - "XAAInfoPtr->NeedToSync = %s\n" - "\n", - pXAA->UsingPixmapCache ? "True" : "False", - pXAA->CanDoMono8x8 ? "True" : "False", - pXAA->CanDoColor8x8 ? "True" : "False", - pXAA->CachePixelGranularity, - pXAA->MaxCacheableTileWidth, - pXAA->MaxCacheableTileHeight, - pXAA->MaxCacheableStippleWidth, - pXAA->MaxCacheableStippleHeight, - pXAA->MonoPatternPitch, - pXAA->CacheWidthMono8x8Pattern, - pXAA->CacheHeightMono8x8Pattern, - pXAA->ColorPatternPitch, - pXAA->CacheWidthColor8x8Pattern, - pXAA->CacheHeightColor8x8Pattern, - pXAA->CacheColorExpandDensity, - pXAA->maxOffPixWidth, - pXAA->maxOffPixHeight, - pXAA->NeedToSync ? "True" : "False"); + ErrorF("XAAInfoPtr->UsingPixmapCache = %s\n" + "XAAInfoPtr->CanDoMono8x8 = %s\n" + "XAAInfoPtr->CanDoColor8x8 = %s\n" + "XAAInfoPtr->CachePixelGranularity = %d\n" + "XAAInfoPtr->MaxCacheableTileWidth = %d\n" + "XAAInfoPtr->MaxCacheableTileHeight = %d\n" + "XAAInfoPtr->MaxCacheableStippleWidth = %d\n" + "XAAInfoPtr->MaxCacheableStippleHeight = %d\n" + "XAAInfoPtr->MonoPatternPitch = %d\n" + "XAAInfoPtr->CacheWidthMono8x8Pattern = %d\n" + "XAAInfoPtr->CacheHeightMono8x8Pattern = %d\n" + "XAAInfoPtr->ColorPatternPitch = %d\n" + "XAAInfoPtr->CacheWidthColor8x8Pattern = %d\n" + "XAAInfoPtr->CacheHeightColor8x8Pattern = %d\n" + "XAAInfoPtr->CacheColorExpandDensity = %d\n" + "XAAInfoPtr->maxOffPixWidth = %d\n" + "XAAInfoPtr->maxOffPixHeight= %d\n" + "XAAInfoPtr->NeedToSync = %s\n" + "\n", + pXAA->UsingPixmapCache ? "True" : "False", + pXAA->CanDoMono8x8 ? "True" : "False", + pXAA->CanDoColor8x8 ? "True" : "False", + pXAA->CachePixelGranularity, + pXAA->MaxCacheableTileWidth, + pXAA->MaxCacheableTileHeight, + pXAA->MaxCacheableStippleWidth, + pXAA->MaxCacheableStippleHeight, + pXAA->MonoPatternPitch, + pXAA->CacheWidthMono8x8Pattern, + pXAA->CacheHeightMono8x8Pattern, + pXAA->ColorPatternPitch, + pXAA->CacheWidthColor8x8Pattern, + pXAA->CacheHeightColor8x8Pattern, + pXAA->CacheColorExpandDensity, + pXAA->maxOffPixWidth, + pXAA->maxOffPixHeight, + pXAA->NeedToSync ? "True" : "False"); */ - - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); - SiSSetupSRCPitch(pSiS->scrnOffset) - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupROP(sisALUConv[rop]) - if (xdir > 0) SiSSetupCMDFlag(X_INC) - if (ydir > 0) SiSSetupCMDFlag(Y_INC) - + + SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupSRCPitch(pSiS->scrnOffset) + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupROP(sisALUConv[rop]) + if (xdir > 0) { + SiSSetupCMDFlag(X_INC) + } + if (ydir > 0) { + SiSSetupCMDFlag(Y_INC) + } } static void SiSSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int src_x, int src_y, int dst_x, int dst_y, int width, int height) { - SISPtr pSiS = SISPTR(pScrn); - long srcbase, dstbase; - - PDEBUG(ErrorF("Subsequent ScreenCopy(%d,%d, %d,%d, %d,%d)\n", - src_x, src_y, dst_x, dst_y, width, height)); - - srcbase=dstbase=0; - if (src_y >= 2048) - { srcbase=pSiS->scrnOffset*src_y; - src_y=0; - } - if (dst_y >= pScrn->virtualY) - { dstbase=pSiS->scrnOffset*dst_y; - dst_y=0; - } - SiSSetupSRCBase(srcbase); - SiSSetupDSTBase(dstbase); - if (!(pSiS->CommandReg & X_INC)) { - src_x += width-1; - dst_x += width-1; - } - if (!(pSiS->CommandReg & Y_INC)) { - src_y += height-1; - dst_y += height-1; - } - SiSSetupRect(width, height) - SiSSetupSRCXY(src_x,src_y) - SiSSetupDSTXY(dst_x,dst_y) - SiSDoCMD + SISPtr pSiS = SISPTR(pScrn); + long srcbase, dstbase; + + PDEBUG(ErrorF("Subsequent ScreenCopy(%d,%d, %d,%d, %d,%d)\n", + src_x, src_y, dst_x, dst_y, width, height)); + + srcbase = dstbase = 0; + if (src_y >= 2048) { + srcbase = pSiS->scrnOffset * src_y; + src_y = 0; + } + if (dst_y >= pScrn->virtualY) { + dstbase = pSiS->scrnOffset*dst_y; + dst_y = 0; + } + SiSSetupSRCBase(srcbase); + SiSSetupDSTBase(dstbase); + if (!(pSiS->CommandReg & X_INC)) { + src_x += width-1; + dst_x += width-1; + } + if (!(pSiS->CommandReg & Y_INC)) { + src_y += height-1; + dst_y += height-1; + } + SiSSetupRect(width, height) + SiSSetupSRCXY(src_x, src_y) + SiSSetupDSTXY(dst_x, dst_y) + SiSDoCMD } static void SiSSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - PDEBUG(ErrorF("Setup SolidFill(0x%x, 0x%x, 0x%x)\n", - color, rop, planemask)); + PDEBUG(ErrorF("Setup SolidFill(0x%x, 0x%x, 0x%x)\n", + color, rop, planemask)); - SiSSetupPATFG(color) + SiSSetupPATFG(color) /* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); - SiSSetupROP(sisPatALUConv[rop]) - SiSSetupCMDFlag(X_INC | Y_INC | PATFG | BITBLT) + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupROP(sisPatALUConv[rop]) + SiSSetupCMDFlag(X_INC | Y_INC | PATFG | BITBLT) } static void SiSSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) { - SISPtr pSiS = SISPTR(pScrn); - long dstbase; - - PDEBUG(ErrorF("Subsequent SolidFillRect(%d, %d, %d, %d)\n", - x, y, w, h)); - dstbase=0; - if (y>=2048) - { dstbase=pSiS->scrnOffset*y; - y=0; - } - SiSSetupDSTBase(dstbase) - SiSSetupDSTXY(x,y) - SiSSetupRect(w,h) - SiSDoCMD + SISPtr pSiS = SISPTR(pScrn); + long dstbase; + + PDEBUG(ErrorF("Subsequent SolidFillRect(%d, %d, %d, %d)\n", + x, y, w, h)); + dstbase = 0; + if (y >= 2048) { + dstbase=pSiS->scrnOffset*y; + y = 0; + } + SiSSetupDSTBase(dstbase) + SiSSetupDSTXY(x,y) + SiSSetupRect(w,h) + SiSDoCMD } static void SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - PDEBUG(ErrorF("Setup SolidLine(0x%x, 0x%x, 0x%x)\n", - color, rop, planemask)); + PDEBUG(ErrorF("Setup SolidLine(0x%x, 0x%x, 0x%x)\n", + color, rop, planemask)); - SiSSetupLineCount(1) - SiSSetupPATFG(color) + SiSSetupLineCount(1) + SiSSetupPATFG(color) /* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); - SiSSetupROP(sisPatALUConv[rop]) - SiSSetupCMDFlag(PATFG | LINE) + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupROP(sisPatALUConv[rop]) + SiSSetupCMDFlag(PATFG | LINE) } static void SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int flags) { - SISPtr pSiS = SISPTR(pScrn); - long dstbase,miny,maxy; - - PDEBUG(ErrorF("Subsequent SolidLine(%d, %d, %d, %d, 0x%x)\n", - x1, y1, x2, y2, flags)); - dstbase=0; - miny=(y1>y2)?y2:y1; - maxy=(y1>y2)?y1:y2; - if (maxy>=2048) - { dstbase=pSiS->scrnOffset*miny; - y1-=miny; - y2-=miny; - } - SiSSetupDSTBase(dstbase) - - SiSSetupX0Y0(x1,y1) - SiSSetupX1Y1(x2,y2) - if (flags & OMIT_LAST) - SiSSetupCMDFlag(NO_LAST_PIXEL) - SiSDoCMD + SISPtr pSiS = SISPTR(pScrn); + long dstbase,miny,maxy; + + PDEBUG(ErrorF("Subsequent SolidLine(%d, %d, %d, %d, 0x%x)\n", + x1, y1, x2, y2, flags)); + + dstbase = 0; + miny = (y1 > y2) ? y2 : y1; + maxy = (y1 > y2) ? y1 : y2; + if (maxy >= 2048) { + dstbase = pSiS->scrnOffset*miny; + y1 -= miny; + y2 -= miny; + } + SiSSetupDSTBase(dstbase) + + SiSSetupX0Y0(x1,y1) + SiSSetupX1Y1(x2,y2) + if (flags & OMIT_LAST) + SiSSetupCMDFlag(NO_LAST_PIXEL) + SiSDoCMD } static void SiSSubsequentSolidHorzVertLine(ScrnInfoPtr pScrn, int x, int y, int len, int dir) { - SISPtr pSiS = SISPTR(pScrn); - long dstbase; - - PDEBUG(ErrorF("Subsequent SolidHorzVertLine(%d, %d, %d, %d)\n", - x, y, len, dir)); - - dstbase=0; - if ((y>=2048) || ((y+len)>=2048)) - { dstbase=pSiS->scrnOffset*y; - y=0; - } - SiSSetupDSTBase(dstbase) - - SiSSetupX0Y0(x,y) - if (dir==DEGREES_0) - { SiSSetupX1Y1(x+len,y);} - else - { SiSSetupX1Y1(x,y+len);} - SiSDoCMD + SISPtr pSiS = SISPTR(pScrn); + long dstbase; + + PDEBUG(ErrorF("Subsequent SolidHorzVertLine(%d, %d, %d, %d)\n", + x, y, len, dir)); + + dstbase = 0; + if ((y >= 2048) || ((y + len) >= 2048)) { + dstbase = pSiS->scrnOffset * y; + y = 0; + } + SiSSetupDSTBase(dstbase) + + SiSSetupX0Y0(x,y) + if (dir == DEGREES_0) { + SiSSetupX1Y1(x + len, y); + } + else { + SiSSetupX1Y1(x, y + len); + } + SiSDoCMD } static void @@ -512,20 +519,21 @@ SiSSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask, int length, unsigned char *pattern) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - PDEBUG(ErrorF("Setup DashedLine(0x%x, 0x%x, 0x%x, 0x%x, %d, 0x%x:%x)\n", - fg, bg, rop, planemask, length, *(pattern+4), *pattern)); + PDEBUG(ErrorF("Setup DashedLine(0x%x, 0x%x, 0x%x, 0x%x, %d, 0x%x:%x)\n", + fg, bg, rop, planemask, length, *(pattern+4), *pattern)); - SiSSetupLineCount(1) + SiSSetupLineCount(1) /* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); - SiSSetupStyleLow(*pattern) - SiSSetupStyleHigh(*(pattern+4)) - SiSSetupROP(sisPatALUConv[rop]) - SiSSetupPATFG(fg) - if (bg != -1) SiSSetupPATBG(bg) + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupStyleLow(*pattern) + SiSSetupStyleHigh(*(pattern+4)) + SiSSetupROP(sisPatALUConv[rop]) + SiSSetupPATFG(fg) + if (bg != -1) + SiSSetupPATBG(bg) } static void @@ -533,47 +541,47 @@ SiSSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int flags, int phase) { - SISPtr pSiS = SISPTR(pScrn); - long dstbase,miny,maxy; - - PDEBUG(ErrorF("Subsequent DashedLine(%d,%d, %d,%d, 0x%x,0x%x)\n", - x1, y1, x2, y2, flags, phase)); - - dstbase=0; - miny=(y1>y2)?y2:y1; - maxy=(y1>y2)?y1:y2; - if (maxy>=2048) - { dstbase=pSiS->scrnOffset*miny; - y1-=miny; - y2-=miny; - } - SiSSetupDSTBase(dstbase) - - SiSSetupX0Y0(x1,y1) - SiSSetupX1Y1(x2,y2) - if (flags & OMIT_LAST) - SiSSetupCMDFlag(NO_LAST_PIXEL) - SiSDoCMD + SISPtr pSiS = SISPTR(pScrn); + long dstbase,miny,maxy; + + PDEBUG(ErrorF("Subsequent DashedLine(%d,%d, %d,%d, 0x%x,0x%x)\n", + x1, y1, x2, y2, flags, phase)); + + dstbase = 0; + miny=(y1 > y2) ? y2 : y1; + maxy=(y1 > y2) ? y1 : y2; + if (maxy >= 2048) { + dstbase = pSiS->scrnOffset * miny; + y1 -= miny; + y2 -= miny; + } + SiSSetupDSTBase(dstbase) + + SiSSetupX0Y0(x1,y1) + SiSSetupX1Y1(x2,y2) + if (flags & OMIT_LAST) { + SiSSetupCMDFlag(NO_LAST_PIXEL) + } + SiSDoCMD } - static void SiSSetupForMonoPatternFill(ScrnInfoPtr pScrn, int patx, int paty, int fg, int bg, int rop, unsigned int planemask) { - SISPtr pSiS = SISPTR(pScrn); - - PDEBUG(ErrorF("Setup MonoPatFill(0x%x,0x%x, 0x%x,0x%x, 0x%x, 0x%x)\n", - patx, paty, fg, bg, rop, planemask)); - - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); - SiSSetupMONOPAT(patx,paty) - SiSSetupPATFG(fg) - SiSSetupROP(sisPatALUConv[rop]) - SiSSetupCMDFlag(PATMONO | X_INC | Y_INC) - SiSSetupPATBG(bg) + SISPtr pSiS = SISPTR(pScrn); + + PDEBUG(ErrorF("Setup MonoPatFill(0x%x,0x%x, 0x%x,0x%x, 0x%x, 0x%x)\n", + patx, paty, fg, bg, rop, planemask)); + + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupMONOPAT(patx,paty) + SiSSetupPATFG(fg) + SiSSetupROP(sisPatALUConv[rop]) + SiSSetupCMDFlag(PATMONO | X_INC | Y_INC) + SiSSetupPATBG(bg) } static void @@ -581,21 +589,21 @@ SiSSubsequentMonoPatternFill(ScrnInfoPtr pScrn, int patx, int paty, int x, int y, int w, int h) { - SISPtr pSiS = SISPTR(pScrn); - long dstbase; - - PDEBUG(ErrorF("Subsequent MonoPatFill(0x%x,0x%x, %d,%d, %d,%d)\n", - patx, paty, x, y, w, h)); - dstbase=0; - if (y>=2048) - { dstbase=pSiS->scrnOffset*y; - y=0; - } - - SiSSetupDSTBase(dstbase) - SiSSetupDSTXY(x,y) - SiSSetupRect(w,h) - SiSDoCMD + SISPtr pSiS = SISPTR(pScrn); + long dstbase; + + PDEBUG(ErrorF("Subsequent MonoPatFill(0x%x,0x%x, %d,%d, %d,%d)\n", + patx, paty, x, y, w, h)); + dstbase = 0; + if (y >= 2048) { + dstbase = pSiS->scrnOffset * y; + y = 0; + } + + SiSSetupDSTBase(dstbase) + SiSSetupDSTXY(x,y) + SiSSetupRect(w,h) + SiSDoCMD } static void @@ -604,16 +612,16 @@ SiSSetupForColorPatternFill(ScrnInfoPtr pScrn, unsigned int planemask, int trans_color) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - PDEBUG(ErrorF("Setup ColorPatFill(0x%x,0x%x, 0x%x,0x%x, 0x%x)\n", - patx, paty, rop, planemask, trans_color)); + PDEBUG(ErrorF("Setup ColorPatFill(0x%x,0x%x, 0x%x,0x%x, 0x%x)\n", + patx, paty, rop, planemask, trans_color)); /* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); - SiSSetupROP(sisPatALUConv[rop]) - SiSSetupCMDFlag(PATPATREG | X_INC | Y_INC) + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupROP(sisPatALUConv[rop]) + SiSSetupCMDFlag(PATPATREG | X_INC | Y_INC) } static void @@ -621,22 +629,21 @@ SiSSubsequentColorPatternFill(ScrnInfoPtr pScrn, int patx, int paty, int x, int y, int w, int h) { - SISPtr pSiS = SISPTR(pScrn); - long dstbase; - - PDEBUG(ErrorF("Subsequent ColorPatFill(0x%x,0x%x, %d,%d, %d,%d)\n", - patx, paty, x, y, w, h)); - - dstbase=0; - if (y>=2048) - { dstbase=pSiS->scrnOffset*y; - y=0; - } - SiSSetupDSTBase(dstbase) - - SiSSetupDSTXY(x,y) - SiSSetupRect(w,h) - SiSDoCMD + SISPtr pSiS = SISPTR(pScrn); + long dstbase; + + PDEBUG(ErrorF("Subsequent ColorPatFill(0x%x,0x%x, %d,%d, %d,%d)\n", + patx, paty, x, y, w, h)); + + dstbase = 0; + if (y >= 2048) { + dstbase = pSiS->scrnOffset * y; + y = 0; + } + SiSSetupDSTBase(dstbase) + SiSSetupDSTXY(x,y) + SiSSetupRect(w,h) + SiSDoCMD } static void @@ -644,48 +651,49 @@ SiSSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask) { - SISPtr pSiS = SISPTR(pScrn); -/* XAAInfoRecPtr pXAA = XAAPTR(pScrn); */ + SISPtr pSiS = SISPTR(pScrn); - PDEBUG(ErrorF("Setup CPUToScreen ColorExpand(0x%x,0x%x, 0x%x,0x%x)\n", - fg, bg, rop, planemask)); + PDEBUG(ErrorF("Setup CPUToScreen ColorExpand(0x%x,0x%x, 0x%x,0x%x)\n", + fg, bg, rop, planemask)); /* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); - SiSSetupSRCXY(0,0) - SiSSetupSRCFG(fg) - SiSSetupROP(sisPatALUConv[rop]) - SiSSetupCMDFlag(X_INC | Y_INC | COLOREXP) - if (bg==-1) - SiSSetupCMDFlag(TRANSPARENT) - else - SiSSetupSRCBG(bg) + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupSRCXY(0,0) + SiSSetupSRCFG(fg) + SiSSetupROP(sisPatALUConv[rop]) + SiSSetupCMDFlag(X_INC | Y_INC | COLOREXP) + if (bg == -1) { + SiSSetupCMDFlag(TRANSPARENT) + } + else { + SiSSetupSRCBG(bg) + } } static void SiSSubsequentCPUToScreenColorExpand(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft) { - SISPtr pSiS = SISPTR(pScrn); - long dstbase; + SISPtr pSiS = SISPTR(pScrn); + long dstbase; - PDEBUG(ErrorF("Subsequent CPUToScreen ColorExpand(%d,%d, %d,%d, %d)\n", - x, y, w, h, skipleft)); + PDEBUG(ErrorF("Subsequent CPUToScreen ColorExpand(%d,%d, %d,%d, %d)\n", + x, y, w, h, skipleft)); - dstbase=0; - if (y>=2048) - { dstbase=pSiS->scrnOffset*y; - y=0; - } - SiSSetupDSTBase(dstbase) + dstbase = 0; + if (y >= 2048) { + dstbase = pSiS->scrnOffset * y; + y = 0; + } + SiSSetupDSTBase(dstbase) /* SiSSetupSRCPitch(((w+31)&0xFFE0)/8)*/ - SiSSetupSRCPitch((w+7)/8) - SiSSetupDSTXY(x,y) - SiSSetupRect(w,h) + SiSSetupSRCPitch((w+7)/8) + SiSSetupDSTXY(x,y) + SiSSetupRect(w,h) /* SiSDoCMD*/ - pSiS->DoColorExpand = TRUE; + pSiS->DoColorExpand = TRUE; } #if 0 @@ -694,19 +702,20 @@ SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask) { - SISPtr pSiS = SISPTR(pScrn); - PDEBUG(ErrorF("Setup ScreenToScreen ColorExp(0x%x,0x%x, 0x%x)\n", - fg, bg, rop)); + SISPtr pSiS = SISPTR(pScrn); + + PDEBUG(ErrorF("Setup ScreenToScreen ColorExp(0x%x,0x%x, 0x%x)\n", + fg, bg, rop)); - SiSSetupDSTBase(0) + SiSSetupDSTBase(0) /* SiSSetupDSTRect(pSiS->scrnOffset, pScrn->virtualY)*/ - SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); - SiSSetupSRCFG(fg) - SiSSetupSRCBG(bg) - SiSSetupSRCXY(0,0) - SiSSetupROP(sisALUConv[rop]) - SiSSetupCMDFlag(X_INC | Y_INC | ENCOLOREXP) + SiSSetupDSTRect(pSiS->scrnOffset, -1) + SiSSetupDSTColorDepth(SISPTR(pScrn)->DstColor); + SiSSetupSRCFG(fg) + SiSSetupSRCBG(bg) + SiSSetupSRCXY(0,0) + SiSSetupROP(sisALUConv[rop]) + SiSSetupCMDFlag(X_INC | Y_INC | ENCOLOREXP) } static void @@ -714,101 +723,119 @@ SiSSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn, int x, int y, int w, int h, int srcx, int srcy, int skipleft) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - PDEBUG(ErrorF("Sub ScreenToScreen ColorExp(%d,%d, %d,%d, %d,%d, %d)\n", - x, y, w, h, srcx, srcy, skipleft)); + PDEBUG(ErrorF("Sub ScreenToScreen ColorExp(%d,%d, %d,%d, %d,%d, %d)\n", + x, y, w, h, srcx, srcy, skipleft)); - SiSSetupSRCPitch(((w+31)&0xFFE0)/8) - SiSSetupDSTXY(x,y) - SiSSetupRect(w,h) - SiSDoCMD + SiSSetupSRCPitch(((w+31)&0xFFE0)/8) + SiSSetupDSTXY(x,y) + SiSSetupRect(w,h) + SiSDoCMD } - #endif static void SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask) { - SISPtr pSiS=SISPTR(pScrn); - - while ((MMIO_IN16(pSiS->IOBase, 0x8242) & 0x1F00)!=0) {} - pSiS->ColorExpandRingHead = 0; - pSiS->ColorExpandRingTail = pSiS->ColorExpandBufferNumber - 1; - SiSSetupSRCXY(0,0); - SiSSetupROP(sisALUConv[rop]); - SiSSetupSRCFG(fg); - SiSSetupDSTRect(pSiS->scrnOffset, -1); - SiSSetupDSTColorDepth(pSiS->DstColor); - if (bg==-1) - { SiSSetupCMDFlag(TRANSPARENT|ENCOLOREXP|X_INC|Y_INC|SRCSYSTEM); - } - else - { SiSSetupSRCBG(bg); - SiSSetupCMDFlag(ENCOLOREXP|X_INC|Y_INC|SRCSYSTEM); - }; + SISPtr pSiS=SISPTR(pScrn); + + while ((MMIO_IN16(pSiS->IOBase, 0x8242) & 0x1F00)!=0) {} + pSiS->ColorExpandRingHead = 0; + pSiS->ColorExpandRingTail = pSiS->ColorExpandBufferNumber - 1; + SiSSetupSRCXY(0,0); + SiSSetupROP(sisALUConv[rop]); + SiSSetupSRCFG(fg); + SiSSetupDSTRect(pSiS->scrnOffset, -1); + SiSSetupDSTColorDepth(pSiS->DstColor); + if (bg == -1) { + SiSSetupCMDFlag(TRANSPARENT | ENCOLOREXP | X_INC | + Y_INC|SRCSYSTEM); + } + else { + SiSSetupSRCBG(bg); + SiSSetupCMDFlag(ENCOLOREXP | X_INC | Y_INC | + SRCSYSTEM); + }; } int srcpitch; int xcurrent, ycurrent; -static void SiSSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft) +static void SiSSubsequentScanlineCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, int x, int y, int w, + int h, int skipleft) { - SISPtr pSiS=SISPTR(pScrn); - int _x0,_y0,_x1,_y1; - long dstbase; - - dstbase=0; - if (y>=2048) - { dstbase=pSiS->scrnOffset*y; - y=0; - } - SiSSetupDSTBase(dstbase) - - if (skipleft > 0) - { _x0=x+skipleft; - _y0=y; - _x1=x+w; - _y1=y+h; - SiSSetupClipLT(_x0,_y0); - SiSSetupClipRB(_x1,_y1); - SiSSetupCMDFlag(CLIPENABLE); - } - SiSSetupRect(w,1); - srcpitch = ((((w+7)/8)+3)>>2)*4; - SiSSetupSRCPitch(srcpitch); - ycurrent=y; - xcurrent=x; + SISPtr pSiS = SISPTR(pScrn); + int _x0, _y0, _x1, _y1; + long dstbase; + + dstbase = 0; + if (y >= 2048) { + dstbase = pSiS->scrnOffset*y; + y = 0; + } + SiSSetupDSTBase(dstbase) + + if (skipleft > 0) { + _x0 = x+skipleft; + _y0 = y; + _x1 = x+w; + _y1 = y+h; + SiSSetupClipLT(_x0, _y0); + SiSSetupClipRB(_x1, _y1); + SiSSetupCMDFlag(CLIPENABLE); + } + SiSSetupRect(w, 1); + srcpitch = ((((w+7)/8)+3) >> 2) * 4; + SiSSetupSRCPitch(srcpitch); + ycurrent = y; + xcurrent = x; } static void SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) { - SISPtr pSiS=SISPTR(pScrn); - int newhead,bltbufstage,newtail; - - SiSSetupSRCBase(pSiS->ColorExpandBufferScreenOffset[bufno]); - SiSSetupDSTXY(xcurrent,ycurrent); - ycurrent++; - SiSDoCMD - newhead = pSiS->ColorExpandRingHead = (bufno + 1) & pSiS->ColorExpandBufferCountMask; - while (newhead == pSiS->ColorExpandRingTail) - { bltbufstage = (int)((MMIO_IN16(pSiS->IOBase,0x8242) & 0x1F00)>>8); - newtail = newhead - (bltbufstage + 1); - pSiS->ColorExpandRingTail = (newtail>=0)? newtail: (pSiS->ColorExpandBufferNumber+newtail); - } + SISPtr pSiS=SISPTR(pScrn); + int newhead,bltbufstage,newtail; + + SiSSetupSRCBase(pSiS->ColorExpandBufferScreenOffset[bufno]); + SiSSetupDSTXY(xcurrent, ycurrent); + ycurrent++; + SiSDoCMD + newhead = pSiS->ColorExpandRingHead = (bufno + 1) & + pSiS->ColorExpandBufferCountMask; + while (newhead == pSiS->ColorExpandRingTail) { + bltbufstage = (int)((MMIO_IN16(pSiS->IOBase,0x8242) & + 0x1F00)>>8); + newtail = newhead - (bltbufstage + 1); + pSiS->ColorExpandRingTail = (newtail >= 0) ? + newtail: (pSiS->ColorExpandBufferNumber+newtail); + } } +static void SiSSetupForImageWrite(ScrnInfoPtr pScrn, int rop, + unsigned int planemask, int trans_color, int bpp, int depth) +{ + return; +} +static void SiSSubsequentImageWriteRect(ScrnInfoPtr pScrn, + int x, int y, int w, int h, int skipleft) +{ + return; +} + +#ifdef DEBUG static void MMIODump(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); - int i; - - SiSIdle - for (i=0x8200; i<=0x823c; i+=4) { - ErrorF("[%x] %0X \n", i, - MMIO_IN32(pSiS->IOBase,i)); - } - + SISPtr pSiS = SISPTR(pScrn); + int i; + + SiSIdle + for (i=0x8200; i <= 0x823c; i += 4) { + ErrorF("[%x] %0X \n", i, + MMIO_IN32(pSiS->IOBase,i)); + } } +#endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h index a5930f729..b7be2decf 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h @@ -26,7 +26,7 @@ * David Thomas <davtom@dream.org.uk>. * Xavier Ducoin <x.ducoin@lectra.com> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h,v 1.2 2000/12/02 01:16:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h,v 1.3 2001/04/19 12:40:33 alanh Exp $ */ /* Definitions for the SIS engine communication. */ @@ -86,7 +86,7 @@ int CmdQueLen; #define SiSIdle \ while( (MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ while( (MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ - CmdQueLen=MMIO_IN16(pSiS->IOBase, 0x8240); + CmdQueLen=MMIO_IN16(pSiS->IOBase, 0x8240); #define SiSSetupSRCBase(base) \ @@ -207,4 +207,3 @@ int CmdQueLen; if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(12), ls);\ CmdQueLen --; - diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c index dc8bebafe..89198aba7 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c @@ -1,17 +1,13 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c,v 1.1 2000/02/12 20:45:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c,v 1.2 2001/04/19 12:40:33 alanh Exp $ */ /* - * - * Acceleration for SiS530 SiS620. - * It is done in a separate file because the register formats are + * Acceleration for SiS530 SiS620. + * It is done in a separate file because the register formats are * very different from the previous chips. - * - * - * - * Xavier Ducoin <x.ducoin@lectra.com> + * + * Xavier Ducoin <x.ducoin@lectra.com> */ -/*#define DEBUG*/ #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" @@ -19,45 +15,42 @@ #include "xf86PciInfo.h" #include "xf86Pci.h" -#include "miline.h" - -#include "sis_regs2.h" +#include "sis530_accel.h" #include "sis.h" +Bool SiS530AccelInit(ScreenPtr pScreen); static void SiS2Sync(ScrnInfoPtr pScrn); static void SiS2SetupForFillRectSolid(ScrnInfoPtr pScrn, int color, - int rop, unsigned int planemask); + int rop, unsigned int planemask); static void SiS2SubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, - int y, int w, int h); + int y, int w, int h); static void SiS2SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int x1, int y1, int x2, - int y2, int w, int h); + int x1, int y1, int x2, + int y2, int w, int h); static void SiS2SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, int rop, + int xdir, int ydir, int rop, unsigned int planemask, - int transparency_color); + int transparency_color); static void SiS2SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, int patterny, int fg, int bg, - int rop, unsigned int planemask); + int patternx, int patterny, int fg, int bg, + int rop, unsigned int planemask); static void SiS2SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, int patterny, int x, int y, - int w, int h); + int patternx, int patterny, int x, int y, + int w, int h); static void SiS2SetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask); + int fg, int bg, int rop, + unsigned int planemask); #if 0 static void SiS2SubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, int skipleft); + int x, int y, int w, int h, + int srcx, int srcy, int skipleft); #endif static void SiS2SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft); + int x, int y, int w, int h, int skipleft); static void SiS2SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); - - static void SiS2InitializeAccelerator(ScrnInfoPtr pScrn) { @@ -80,8 +73,8 @@ SiS530AccelInit(ScreenPtr pScreen) /* fill out infoPtr here */ infoPtr->Flags = PIXMAP_CACHE | - OFFSCREEN_PIXMAPS | - LINEAR_FRAMEBUFFER; + OFFSCREEN_PIXMAPS | + LINEAR_FRAMEBUFFER; /* sync */ infoPtr->Sync = SiS2Sync; @@ -95,24 +88,24 @@ SiS530AccelInit(ScreenPtr pScreen) /* screen to screen copy */ infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | NO_PLANEMASK; - infoPtr->SetupForScreenToScreenCopy = - SiS2SetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = - SiS2SubsequentScreenToScreenCopy; + infoPtr->SetupForScreenToScreenCopy = + SiS2SetupForScreenToScreenCopy; + infoPtr->SubsequentScreenToScreenCopy = + SiS2SubsequentScreenToScreenCopy; /* 8x8 mono patterns */ infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS | + HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_PROGRAMMED_ORIGIN | NO_TRANSPARENCY | /* transp does not work right now */ - BIT_ORDER_IN_BYTE_MSBFIRST; + BIT_ORDER_IN_BYTE_MSBFIRST; infoPtr->SetupForMono8x8PatternFill = - SiS2SetupForMono8x8PatternFill; + SiS2SetupForMono8x8PatternFill; infoPtr->SubsequentMono8x8PatternFillRect = - SiS2SubsequentMono8x8PatternFillRect; + SiS2SubsequentMono8x8PatternFillRect; /* screen to screen color expansion */ #if 0 @@ -122,9 +115,9 @@ SiS530AccelInit(ScreenPtr pScreen) infoPtr->ScreenToScreenColorExpandFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD | - /*GXCOPY_ONLY | be careful not fully tested */ - TRANSPARENCY_ONLY | /* opaque does not work right now */ - NO_PLANEMASK; + /*GXCOPY_ONLY | be careful not fully tested */ + TRANSPARENCY_ONLY | /* opaque does not work right now */ + NO_PLANEMASK; infoPtr->SetupForScreenToScreenColorExpandFill = SiS2SetupForScreenToScreenColorExpandFill; @@ -143,23 +136,23 @@ SiS530AccelInit(ScreenPtr pScreen) BLTPatternOffscreenSize = 2 * (((pScrn->virtualX + 31)/32) * 4); if (OffscreenAvailable < BLTPatternOffscreenSize) { xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 0, - "Not enough off-screen video memory for expand color.\n"); + "Not enough off-screen video memory for expand color.\n"); } else { infoPtr->ScanlineCPUToScreenColorExpandFillFlags = - SYNC_AFTER_COLOR_EXPAND | + SYNC_AFTER_COLOR_EXPAND | BIT_ORDER_IN_BYTE_MSBFIRST | - SCANLINE_PAD_DWORD | - /*GXCOPY_ONLY | not fully tested */ - TRANSPARENCY_ONLY | /* opaque doesn't work*/ - NO_PLANEMASK; + SCANLINE_PAD_DWORD | + /*GXCOPY_ONLY | not fully tested */ + TRANSPARENCY_ONLY | /* opaque doesn't work*/ + NO_PLANEMASK; pSiS->XAAScanlineColorExpandBuffers[0] = - pSiS->FbBase + pSiS->FbMapSize - offset - - (((pScrn->virtualX + 31)/32) * 4); + pSiS->FbBase + pSiS->FbMapSize - offset - + (((pScrn->virtualX + 31)/32) * 4); pSiS->XAAScanlineColorExpandBuffers[1] = - pSiS->FbBase + pSiS->FbMapSize - offset - - (((pScrn->virtualX + 31)/32) * 4)*2; + pSiS->FbBase + pSiS->FbMapSize - offset - + (((pScrn->virtualX + 31)/32) * 4)*2; infoPtr->NumScanlineColorExpandBuffers = 2; infoPtr->ScanlineColorExpandBuffers = @@ -167,18 +160,18 @@ SiS530AccelInit(ScreenPtr pScreen) offset += BLTPatternOffscreenSize; infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - SiS2SetupForScreenToScreenColorExpandFill; + SiS2SetupForScreenToScreenColorExpandFill; infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - SiS2SubsequentScanlineCPUToScreenColorExpandFill; + SiS2SubsequentScanlineCPUToScreenColorExpandFill; infoPtr->SubsequentColorExpandScanline = - SiS2SubsequentColorExpandScanline; + SiS2SubsequentColorExpandScanline; } AvailFBArea.x1 = 0; AvailFBArea.y1 = 0; AvailFBArea.x2 = pScrn->displayWidth; AvailFBArea.y2 = (pSiS->FbMapSize - offset) / (pScrn->displayWidth * - pScrn->bitsPerPixel / 8); + pScrn->bitsPerPixel / 8); xf86InitFBManager(pScreen, &AvailFBArea); @@ -193,47 +186,47 @@ SiS2Sync(ScrnInfoPtr pScrn) { static int sisALUConv[] = { - 0x00, /* dest = 0; 0, GXclear, 0 */ - 0x88, /* dest &= src; DSa, GXand, 0x1 */ - 0x44, /* dest = src & ~dest; SDna, GXandReverse, 0x2 */ - 0xCC, /* dest = src; S, GXcopy, 0x3 */ - 0x22, /* dest &= ~src; DSna, GXandInverted, 0x4 */ - 0xAA, /* dest = dest; D, GXnoop, 0x5 */ - 0x66, /* dest = ^src; DSx, GXxor, 0x6 */ - 0xEE, /* dest |= src; DSo, GXor, 0x7 */ - 0x11, /* dest = ~src & ~dest; DSon, GXnor, 0x8 */ - 0x99, /* dest ^= ~src ; DSxn, GXequiv, 0x9 */ - 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */ - 0xDD, /* dest = src|~dest ; SDno, GXorReverse, 0xB */ - 0x33, /* dest = ~src; Sn, GXcopyInverted, 0xC */ - 0xBB, /* dest |= ~src; DSno, GXorInverted, 0xD */ - 0x77, /* dest = ~src|~dest; DSan, GXnand, 0xE */ - 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ + 0x00, /* dest = 0; 0, GXclear, 0 */ + 0x88, /* dest &= src; DSa, GXand, 0x1 */ + 0x44, /* dest = src & ~dest; SDna, GXandReverse, 0x2 */ + 0xCC, /* dest = src; S, GXcopy, 0x3 */ + 0x22, /* dest &= ~src; DSna, GXandInverted, 0x4 */ + 0xAA, /* dest = dest; D, GXnoop, 0x5 */ + 0x66, /* dest = ^src; DSx, GXxor, 0x6 */ + 0xEE, /* dest |= src; DSo, GXor, 0x7 */ + 0x11, /* dest = ~src & ~dest; DSon, GXnor, 0x8 */ + 0x99, /* dest ^= ~src ; DSxn, GXequiv, 0x9 */ + 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */ + 0xDD, /* dest = src|~dest ; SDno, GXorReverse, 0xB */ + 0x33, /* dest = ~src; Sn, GXcopyInverted, 0xC */ + 0xBB, /* dest |= ~src; DSno, GXorInverted, 0xD */ + 0x77, /* dest = ~src|~dest; DSan, GXnand, 0xE */ + 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ }; /* same ROP but with Pattern as Source */ static int sisPatALUConv[] = { - 0x00, /* dest = 0; 0, GXclear, 0 */ - 0xA0, /* dest &= src; DPa, GXand, 0x1 */ - 0x50, /* dest = src & ~dest; PDna, GXandReverse, 0x2 */ - 0xF0, /* dest = src; P, GXcopy, 0x3 */ - 0x0A, /* dest &= ~src; DPna, GXandInverted, 0x4 */ - 0xAA, /* dest = dest; D, GXnoop, 0x5 */ - 0x5A, /* dest = ^src; DPx, GXxor, 0x6 */ - 0xFA, /* dest |= src; DPo, GXor, 0x7 */ - 0x05, /* dest = ~src & ~dest; DPon, GXnor, 0x8 */ - 0xA5, /* dest ^= ~src ; DPxn, GXequiv, 0x9 */ - 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */ - 0xF5, /* dest = src|~dest ; PDno, GXorReverse, 0xB */ - 0x0F, /* dest = ~src; Pn, GXcopyInverted, 0xC */ - 0xAF, /* dest |= ~src; DPno, GXorInverted, 0xD */ - 0x5F, /* dest = ~src|~dest; DPan, GXnand, 0xE */ - 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ + 0x00, /* dest = 0; 0, GXclear, 0 */ + 0xA0, /* dest &= src; DPa, GXand, 0x1 */ + 0x50, /* dest = src & ~dest; PDna, GXandReverse, 0x2 */ + 0xF0, /* dest = src; P, GXcopy, 0x3 */ + 0x0A, /* dest &= ~src; DPna, GXandInverted, 0x4 */ + 0xAA, /* dest = dest; D, GXnoop, 0x5 */ + 0x5A, /* dest = ^src; DPx, GXxor, 0x6 */ + 0xFA, /* dest |= src; DPo, GXor, 0x7 */ + 0x05, /* dest = ~src & ~dest; DPon, GXnor, 0x8 */ + 0xA5, /* dest ^= ~src ; DPxn, GXequiv, 0x9 */ + 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */ + 0xF5, /* dest = src|~dest ; PDno, GXorReverse, 0xB */ + 0x0F, /* dest = ~src; Pn, GXcopyInverted, 0xC */ + 0xAF, /* dest |= ~src; DPno, GXorInverted, 0xD */ + 0x5F, /* dest = ~src|~dest; DPan, GXnand, 0xE */ + 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ }; static void SiS2SetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) + unsigned int planemask) { SISPtr pSiS = SISPTR(pScrn); @@ -242,8 +235,8 @@ SiS2SetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, sisSETPATFGCOLOR(color); sisSETROP(sisPatALUConv[rop & 0xF]); sisSETPITCH(pScrn->displayWidth * pScrn->bitsPerPixel / 8, - pScrn->displayWidth * pScrn->bitsPerPixel / 8); - sisSETDSTHEIGHT(-1); /* disable merge clipping */ + pScrn->displayWidth * pScrn->bitsPerPixel / 8); + sisSETDSTHEIGHT(-1); /* disable merge clipping */ sisSETSRCADDR(0); sisSETDSTADDR(0); @@ -268,17 +261,17 @@ SiS2SubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, int w, int h) static void SiS2SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, - int rop, unsigned int planemask, - int transparency_color) + int rop, unsigned int planemask, + int transparency_color) { SISPtr pSiS = SISPTR(pScrn); PDEBUG(ErrorF("SiS2SetupForScreenToScreenCopy()\n")); sisBLTWAIT; sisSETPITCH(pScrn->displayWidth * pScrn->bitsPerPixel / 8, - pScrn->displayWidth * pScrn->bitsPerPixel / 8); + pScrn->displayWidth * pScrn->bitsPerPixel / 8); sisSETROP(sisALUConv[rop & 0xF]); - sisSETDSTHEIGHT(-1); /* disable merge clipping */ + sisSETDSTHEIGHT(-1); /* disable merge clipping */ sisSETSRCADDR(0); sisSETDSTADDR(0); pSiS->Xdirection = xdir; @@ -287,25 +280,25 @@ SiS2SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, static void SiS2SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, - int y2, int w, int h) + int y2, int w, int h) { SISPtr pSiS = SISPTR(pScrn); int op ; op = sisCMDBLT | sisSRCVIDEO | sisROP; if (pSiS->Ydirection == -1) { - op |= sisBOTTOM2TOP; + op |= sisBOTTOM2TOP; y1 += h-1; - y2 += h-1; + y2 += h-1; } else { - op |= sisTOP2BOTTOM; + op |= sisTOP2BOTTOM; } if (pSiS->Xdirection == -1) { - op |= sisRIGHT2LEFT; - x1 += w-1; - x2 += w-1; + op |= sisRIGHT2LEFT; + x1 += w-1; + x2 += w-1; } else { - op |= sisLEFT2RIGHT; + op |= sisLEFT2RIGHT; } sisSETHEIGHTWIDTH(h, w); @@ -317,14 +310,14 @@ SiS2SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, static void SiS2SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, - int fg, int bg, int rop, unsigned int planemask) + int fg, int bg, int rop, unsigned int planemask) { SISPtr pSiS = SISPTR(pScrn); - unsigned int *patternRegPtr ; - int dstpitch; - int isTransparent = ( bg == -1 ); - int op = sisCMDCOLEXP | sisTOP2BOTTOM | sisLEFT2RIGHT | - sisPATMASK; + unsigned int *patternRegPtr ; + int dstpitch; + int isTransparent = ( bg == -1 ); + int op = sisCMDCOLEXP | sisTOP2BOTTOM | sisLEFT2RIGHT | + sisPATMASK; PDEBUG(ErrorF("SiS2SetupFor8x8PatternColorExpand()\n")); @@ -337,17 +330,17 @@ SiS2SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, op |= sisTRANSPARENT; PDEBUG(ErrorF("doesn't work right now: should never be called\n")); } - + sisBLTWAIT; sisSETPATBGCOLOR(bg); sisSETPATFGCOLOR(fg); - sisSETROP(sisPatALUConv[rop & 0xF]); /* pat copy */ + sisSETROP(sisPatALUConv[rop & 0xF]); /* pat copy */ sisSETPITCH(1, dstpitch); sisSETSRCADDR(0); sisSETDSTADDR(0); sisSETSRCXSRCY(0,0); - sisSETDSTHEIGHT(-1); /* disable merge clipping */ + sisSETDSTHEIGHT(-1); /* disable merge clipping */ pSiS->CommandReg = op | sisROP ; patternRegPtr = (unsigned int *)sisSETPATMASKREG(); @@ -357,7 +350,7 @@ SiS2SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, static void SiS2SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, - int patterny, int x, int y, int w, int h) + int patterny, int x, int y, int w, int h) { SISPtr pSiS = SISPTR(pScrn); /* @@ -372,13 +365,13 @@ SiS2SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, static void SiS2SetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask) + int fg, int bg, int rop, + unsigned int planemask) { SISPtr pSiS = SISPTR(pScrn); int isTransparent = ( bg == -1 ); - int op ; + int op ; PDEBUG(ErrorF("SiS2SetupScreenToScreenColorExpand()\n")); @@ -387,17 +380,17 @@ SiS2SetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, if (isTransparent) { op |= sisTRANSPARENT; } - + sisBLTWAIT; sisSETPATBGCOLOR(bg); sisSETPATFGCOLOR(fg); /* becareful with rop */ - sisSETROP(sisPatALUConv[rop & 0xF]); + sisSETROP(sisPatALUConv[rop & 0xF]); sisSETDSTADDR(0); sisSETSRCADDR(0); sisSETSRCXSRCY(0,0); - sisSETDSTHEIGHT(-1); /* disable merge clipping */ + sisSETDSTHEIGHT(-1); /* disable merge clipping */ pSiS->CommandReg = op | sisROP; @@ -405,8 +398,8 @@ SiS2SetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, #if 0 static void SiS2SubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, int skipleft) + int x, int y, int w, int h, + int srcx, int srcy, int skipleft) { SISPtr pSiS = SISPTR(pScrn); @@ -420,7 +413,8 @@ SiS2SubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, sisSETCMD(pSiS->CommandReg); } #endif -void + +static void SiS2SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft) { @@ -440,7 +434,7 @@ SiS2SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, } -void +static void SiS2SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) { @@ -458,13 +452,3 @@ SiS2SubsequentColorExpandScanline(ScrnInfoPtr pScrn, sisBLTWAIT; pSiS->DstY++; } - - - - - - - - - - diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.h new file mode 100644 index 000000000..c3a968b8c --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.h @@ -0,0 +1,198 @@ +/* + * Copyright 1998,1999 by Alan Hourihane, Wigan, England. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Alan Hourihane not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Alan Hourihane makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk + * Mike Chapman <mike@paranoia.com>, + * Juanjo Santamarta <santamarta@ctv.es>, + * Mitani Hiroshi <hmitani@drl.mei.co.jp> + * David Thomas <davtom@dream.org.uk>. + * Xavier Ducoin <x.ducoin@lectra.com> + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.h,v 1.1 2001/04/19 12:45:22 alanh Exp $ */ + +/* 3C4 */ +#define BankReg 0x06 +#define ExtGraphicControl 0x06 +#define ClockReg 0x07 +#define CPUThreshold 0x08 +#define CRTThreshold 0x09 +#define CRTCOff 0x0A +#define DualBanks 0x0B +#define MMIOEnable 0x0B +#define RAMSize 0x0C +#define Mode64 0x0C +#define ExtConfStatus1 0x0E +#define ExtHoznOver 0x12 +#define ClockBase 0x13 +#define LinearAdd0 0x20 +#define LinearAdd1 0x21 +#define GraphEng 0x27 +#define MemClock0 0x28 +#define MemClock1 0x29 +#define XR2A 0x2A +#define XR2B 0x2B +#define TurboQueueBase 0x2C +#define FBSize 0x2F +#define ExtMiscCont5 0x34 +#define ExtMiscCont9 0x3C + +/* 3x4 */ +#define Offset 0x13 + +#define read_xr(num,var) do {outb(0x3c4, num);var=inb(0x3c5);} while (0) + +/* Definitions for the SIS engine communication. */ + +extern int sis2Reg32MMIO[]; +#define BR(x) sis2Reg32MMIO[x] + +#define sisLEFT2RIGHT 0x00010000 +#define sisRIGHT2LEFT 0x00000000 +#define sisTOP2BOTTOM 0x00020000 +#define sisBOTTOM2TOP 0x00000000 + +#define sisSRCSYSTEM 0x00000010 +#define sisSRCVIDEO 0x00000000 + +#define sisNOMERGECLIP 0x04000000 + +#define sisCMDBLT 0x00000000 +#define sisCMDCOLEXP 0x00000001 +#define sisCMDLINE 0x00000004 +#define sisCMDENHCOLEXP 0x00000002 + +#define sisTRANSPARENT 0x00100000 + +#define sisCLIPINTRN 0x00000000 +#define sisCLIPEXTRN 0x04000000 +#define sisCLIPENABL 0x00040000 + +#define sisPATFG 0x00000000 +#define sisPATREG 0x00000040 +#define sisPATMASK 0x00000080 + +/* Macros to do useful things with the SIS BitBLT engine */ + +/* + bit 31 2D engine: 1 is idle, + bit 30 3D engine: 1 is idle, + bit 29 Command queue: 1 is empty +*/ +#define sisBLTSync \ + while((*(volatile unsigned short *)(pSiS->IOBase + BR(16)+2) & \ + 0xE000) != 0xE000){} + +#define sisBLTWAIT \ + if (!pSiS->TurboQueue) {\ + while(!(*(volatile unsigned short *)(pSiS->IOBase + BR(16)+2) & \ + (0x8000))){}} + +#define sisSETPATMASKREG()\ + ((unsigned char *)(pSiS->IOBase + BR(11))) + +#define sisSETPATREG()\ + ((unsigned char *)(pSiS->IOBase + BR(17))) + +#define sisSETCMD(op) \ + *(volatile unsigned long *)(pSiS->IOBase + BR(15) ) = op + +#define sisSETROP(op) \ + pSiS->ROPReg = (op<<8) + +#define sisROP pSiS->ROPReg + +#define sisSETSRCADDR(srcAddr) \ + *(volatile unsigned long *)(pSiS->IOBase + BR(0)) = srcAddr + +#define sisSETDSTADDR(dstAddr) \ + *(volatile unsigned int *)(pSiS->IOBase + BR(4)) = dstAddr + +#define sisSETPITCH(srcPitch,dstPitch) \ + *(volatile unsigned short *)(pSiS->IOBase + BR(1)) = (srcPitch); \ + *(volatile unsigned short *)(pSiS->IOBase + BR(5)) = (dstPitch) + +#define sisSETHEIGHTWIDTH(Height,Width)\ + *(volatile unsigned int *)(pSiS->IOBase + BR(6)) = (((Height)&0xFFFF)<<16) | ((Width)&0xFFFF) + +#define sisSETDSTHEIGHT(Height)\ + *(volatile unsigned short *)(pSiS->IOBase + BR(5)+2) = (Height) + + +#define sisSETSRCXSRCY(X,Y)\ + *(volatile unsigned int *)(pSiS->IOBase + BR(2)) = (((X)&0xFFFF)<<16)| \ + ((Y)&0xFFFF) + +#define sisSETDSTXDSTY(X,Y)\ + *(volatile unsigned int *)(pSiS->IOBase + BR(3)) = (((X)&0xFFFF)<<16)| \ + ((Y)&0xFFFF) + +#define sisSETCLIPTOP(x,y)\ + *(volatile unsigned int *)(pSiS->IOBase + BR(13)) = (((y)&0xFFFF)<<16)| \ + ((x)&0xFFFF) + +#define sisSETCLIPBOTTOM(x,y)\ + *(volatile unsigned int *)(pSiS->IOBase + BR(14)) = (((y)&0xFFFF)<<16)| \ + ((x)&0xFFFF) + + +#define sisSETBGCOLOR(bgColor)\ + *(volatile unsigned int *)(pSiS->IOBase + BR(10)) = (bgColor) + +#define sisSETFGCOLOR(fgColor)\ + *(volatile unsigned int *)(pSiS->IOBase + BR(9)) = (fgColor) + + +#define sisSETPATBGCOLOR(bgColor)\ + *(volatile unsigned int *)(pSiS->IOBase + BR(8)) = (bgColor) + +#define sisSETPATFGCOLOR(fgColor)\ + *(volatile unsigned int *)(pSiS->IOBase + BR(7)) = (fgColor) + + +#define sisEnableCRT1HWCursor()\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8500) |= 0x40000000; +#define sisDisableCRT1HWCursor()\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8500) &= 0xBFFFFFFF; + +#define sisSetCRT1CursorBGColor(color)\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8504) = (color); +#define sisSetCRT1CursorFGColor(color)\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8508) = (color); + +#define sisSetCRT1CursorPositionX(x,preset)\ + *(volatile unsigned int *)(pSiS->IOBase + 0x850C) = (x) | ((preset) << 16); +#define sisSetCRT1CursorPositionY(y,preset)\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8510) = (y) | ((preset) << 16); + +#define sisEnableCRT2HWCursor()\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8520) |= 0x40000000; +#define sisDisableCRT2HWCursor()\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8520) &= 0xBFFFFFFF; + +#define sisSetCRT2CursorBGColor(color)\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8524) = (color); +#define sisSetCRT2CursorFGColor(color)\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8528) = (color); + +#define sisSetCRT2CursorPositionX(x,preset)\ + *(volatile unsigned int *)(pSiS->IOBase + 0x852C) = (x) | ((preset) << 16); +#define sisSetCRT2CursorPositionY(y,preset)\ + *(volatile unsigned int *)(pSiS->IOBase + 0x8530) = (y) | ((preset) << 16); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c index 380261b90..a90e88658 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c,v 1.19 2000/12/02 01:16:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c,v 1.20 2001/04/19 12:40:33 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -7,56 +7,41 @@ #include "xf86PciInfo.h" #include "xf86Pci.h" -#include "miline.h" - #include "sis_regs.h" #include "sis.h" #include "xaarop.h" +Bool SiSAccelInit(ScreenPtr pScreen); static void SiSSync(ScrnInfoPtr pScrn); - static void SiSSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, - int rop, unsigned int planemask); - + int rop, unsigned int planemask); static void SiSSubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, - int y, int w, int h); - + int y, int w, int h); static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, - int xdir, int ydir, int rop, - unsigned int planemask, - int transparency_color); - + int xdir, int ydir, int rop, + unsigned int planemask, int transparency_color); static void SiSSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, - int x1, int y1, int x2, - int y2, int w, int h); - + int x1, int y1, int x2, + int y2, int w, int h); static void SiSSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int patternx, int patterny, int fg, int bg, - int rop, unsigned int planemask); - + int patternx, int patterny, int fg, int bg, + int rop, unsigned int planemask); static void SiSSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, - int patternx, int patterny, int x, int y, - int w, int h); - + int patternx, int patterny, int x, int y, + int w, int h); static void SiSSetupForScreenToScreenColorExpandFill (ScrnInfoPtr pScrn, - int fg, int bg, - int rop, unsigned int planemask); - + int fg, int bg, + int rop, unsigned int planemask); static void SiSSubsequentScreenToScreenColorExpandFill( ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, int offset ); - + int x, int y, int w, int h, + int srcx, int srcy, int offset ); static void SiSSetClippingRectangle ( ScrnInfoPtr pScrn, - int left, int top, int right, int bottom); - + int left, int top, int right, int bottom); static void SiSDisableClipping (ScrnInfoPtr pScrn); - static void SiSSetupForSolidLine(ScrnInfoPtr pScrn, - int color, int rop, unsigned int planemask); - + int color, int rop, unsigned int planemask); static void SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int flags); - static void SiSSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len, int dir); @@ -71,31 +56,32 @@ SiSAccelInit(ScreenPtr pScreen) int offset; pSiS->AccelInfoPtr = infoPtr = XAACreateInfoRec(); - if (!infoPtr) return FALSE; + if (!infoPtr) + return FALSE; infoPtr->Flags = PIXMAP_CACHE | - OFFSCREEN_PIXMAPS | - LINEAR_FRAMEBUFFER; + OFFSCREEN_PIXMAPS | + LINEAR_FRAMEBUFFER; infoPtr->Sync = SiSSync; /* Clipping and lines only works on 5597 and 6326 for 1024, 2048, 4096 logical width */ if (pSiS->ValidWidth) { - infoPtr->SetClippingRectangle = SiSSetClippingRectangle; - infoPtr->DisableClipping = SiSDisableClipping; - infoPtr->ClippingFlags = - HARDWARE_CLIP_SOLID_LINE | - HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY | - HARDWARE_CLIP_MONO_8x8_FILL | - HARDWARE_CLIP_SOLID_FILL ; - - /* Solid Lines */ - infoPtr->SolidLineFlags = NO_PLANEMASK | - BIT_ORDER_IN_BYTE_MSBFIRST; - - infoPtr->SetupForSolidLine = SiSSetupForSolidLine; - infoPtr->SubsequentSolidTwoPointLine = SiSSubsequentSolidTwoPointLine; - infoPtr->SubsequentSolidHorVertLine = SiSSubsequentSolidHorVertLine; + infoPtr->SetClippingRectangle = SiSSetClippingRectangle; + infoPtr->DisableClipping = SiSDisableClipping; + infoPtr->ClippingFlags = + HARDWARE_CLIP_SOLID_LINE | + HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY | + HARDWARE_CLIP_MONO_8x8_FILL | + HARDWARE_CLIP_SOLID_FILL ; + + /* Solid Lines */ + infoPtr->SolidLineFlags = NO_PLANEMASK | + BIT_ORDER_IN_BYTE_MSBFIRST; + + infoPtr->SetupForSolidLine = SiSSetupForSolidLine; + infoPtr->SubsequentSolidTwoPointLine = SiSSubsequentSolidTwoPointLine; + infoPtr->SubsequentSolidHorVertLine = SiSSubsequentSolidHorVertLine; } infoPtr->SolidFillFlags = NO_PLANEMASK; @@ -103,49 +89,52 @@ SiSAccelInit(ScreenPtr pScreen) infoPtr->SubsequentSolidFillRect = SiSSubsequentFillRectSolid; infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | NO_PLANEMASK; - infoPtr->SetupForScreenToScreenCopy = - SiSSetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = - SiSSubsequentScreenToScreenCopy; + infoPtr->SetupForScreenToScreenCopy = + SiSSetupForScreenToScreenCopy; + infoPtr->SubsequentScreenToScreenCopy = + SiSSubsequentScreenToScreenCopy; if (pScrn->bitsPerPixel != 24) { - infoPtr->Mono8x8PatternFillFlags = - NO_PLANEMASK | - HARDWARE_PATTERN_PROGRAMMED_BITS | - HARDWARE_PATTERN_PROGRAMMED_ORIGIN | - BIT_ORDER_IN_BYTE_MSBFIRST; + infoPtr->Mono8x8PatternFillFlags = + NO_PLANEMASK | + HARDWARE_PATTERN_PROGRAMMED_BITS | + HARDWARE_PATTERN_PROGRAMMED_ORIGIN | + BIT_ORDER_IN_BYTE_MSBFIRST; infoPtr->SetupForMono8x8PatternFill = - SiSSetupForMono8x8PatternFill; + SiSSetupForMono8x8PatternFill; infoPtr->SubsequentMono8x8PatternFillRect = - SiSSubsequentMono8x8PatternFillRect; + SiSSubsequentMono8x8PatternFillRect; } #if 0 /* Don't work until we implement skipleft */ if (pScrn->bitsPerPixel != 24) { - infoPtr->ScreenToScreenColorExpandFillFlags = GXCOPY_ONLY | - CPU_TRANSFER_PAD_DWORD | - SCANLINE_PAD_DWORD | - NO_PLANEMASK | - HARDWARE_PATTERN_PROGRAMMED_BITS | - HARDWARE_PATTERN_PROGRAMMED_ORIGIN | - BIT_ORDER_IN_BYTE_MSBFIRST; - - infoPtr->SetupForScreenToScreenColorExpandFill = - SiSSetupForScreenToScreenColorExpandFill; - infoPtr->SubsequentScreenToScreenColorExpandFill = - SiSSubsequentScreenToScreenColorExpandFill; + infoPtr->ScreenToScreenColorExpandFillFlags = GXCOPY_ONLY | + CPU_TRANSFER_PAD_DWORD | + SCANLINE_PAD_DWORD | + NO_PLANEMASK | + HARDWARE_PATTERN_PROGRAMMED_BITS | + HARDWARE_PATTERN_PROGRAMMED_ORIGIN | + BIT_ORDER_IN_BYTE_MSBFIRST; + + infoPtr->SetupForScreenToScreenColorExpandFill = + SiSSetupForScreenToScreenColorExpandFill; + infoPtr->SubsequentScreenToScreenColorExpandFill = + SiSSubsequentScreenToScreenColorExpandFill; } #endif AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; + AvailFBArea.y1 = 0; AvailFBArea.x2 = pScrn->displayWidth; - if (pSiS->HWCursor || pSiS->TurboQueue) offset = 262144; - else offset = 0; + if (pSiS->HWCursor || pSiS->TurboQueue) + offset = 262144; + else + offset = 0; AvailFBArea.y2 = (pSiS->FbMapSize - offset) / (pScrn->displayWidth * - pScrn->bitsPerPixel / 8); + pScrn->bitsPerPixel / 8); - if (AvailFBArea.y2 < 0) AvailFBArea.y2 = 32767; + if (AvailFBArea.y2 < 0) + AvailFBArea.y2 = 32767; xf86InitFBManager(pScreen, &AvailFBArea); @@ -160,7 +149,7 @@ SiSSync(ScrnInfoPtr pScrn) { static void SiSSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) + unsigned int planemask) { SISPtr pSiS = SISPTR(pScrn); @@ -168,7 +157,7 @@ SiSSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, sisSETBGCOLOR(color); sisSETROP(XAACopyROP[rop]); sisSETPITCH(pScrn->displayWidth * pScrn->bitsPerPixel / 8, - pScrn->displayWidth * pScrn->bitsPerPixel / 8); + pScrn->displayWidth * pScrn->bitsPerPixel / 8); /* * If you don't support a write planemask, and have set the * appropriate flag, then the planemask can be safely ignored. @@ -185,7 +174,8 @@ SiSSubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, int w, int h) destaddr = y * pScrn->displayWidth + x; op = sisCMDBLT | sisSRCBG | sisTOP2BOTTOM | sisLEFT2RIGHT; - if (pSiS->ClipEnabled) op |= sisCLIPINTRN | sisCLIPENABL; + if (pSiS->ClipEnabled) + op |= sisCLIPINTRN | sisCLIPENABL; destaddr *= (pScrn->bitsPerPixel / 8); sisSETHEIGHTWIDTH(h-1, w * (pScrn->bitsPerPixel/8)-1); @@ -196,12 +186,12 @@ SiSSubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, int w, int h) static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, - int rop, unsigned int planemask, - int transparency_color) + int rop, unsigned int planemask, + int transparency_color) { SISPtr pSiS = SISPTR(pScrn); sisSETPITCH(pScrn->displayWidth * pScrn->bitsPerPixel / 8, - pScrn->displayWidth * pScrn->bitsPerPixel / 8); + pScrn->displayWidth * pScrn->bitsPerPixel / 8); sisSETROP(XAACopyROP[rop]); pSiS->Xdirection = xdir; pSiS->Ydirection = ydir; @@ -209,7 +199,7 @@ SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, static void SiSSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, - int y2, int w, int h) + int y2, int w, int h) { SISPtr pSiS = SISPTR(pScrn); int srcaddr, destaddr; @@ -217,29 +207,30 @@ SiSSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, op = sisCMDBLT | sisSRCVIDEO; if (pSiS->Ydirection == -1) { - op |= sisBOTTOM2TOP; + op |= sisBOTTOM2TOP; srcaddr = (y1 + h - 1) * pScrn->displayWidth; - destaddr = (y2 + h - 1) * pScrn->displayWidth; + destaddr = (y2 + h - 1) * pScrn->displayWidth; } else { - op |= sisTOP2BOTTOM; + op |= sisTOP2BOTTOM; srcaddr = y1 * pScrn->displayWidth; destaddr = y2 * pScrn->displayWidth; } if (pSiS->Xdirection == -1) { - op |= sisRIGHT2LEFT; - srcaddr += x1 + w - 1; - destaddr += x2 + w - 1; + op |= sisRIGHT2LEFT; + srcaddr += x1 + w - 1; + destaddr += x2 + w - 1; } else { - op |= sisLEFT2RIGHT; - srcaddr += x1; - destaddr += x2; + op |= sisLEFT2RIGHT; + srcaddr += x1; + destaddr += x2; } - if (pSiS->ClipEnabled) op |= sisCLIPINTRN | sisCLIPENABL; + if (pSiS->ClipEnabled) + op |= sisCLIPINTRN | sisCLIPENABL; srcaddr *= (pScrn->bitsPerPixel/8); destaddr *= (pScrn->bitsPerPixel/8); - if ( ((pScrn->bitsPerPixel/8)>1) && (pSiS->Xdirection == -1) ) { - srcaddr += (pScrn->bitsPerPixel/8)-1; - destaddr += (pScrn->bitsPerPixel/8)-1; + if (((pScrn->bitsPerPixel/8)>1) && (pSiS->Xdirection == -1)) { + srcaddr += (pScrn->bitsPerPixel/8)-1; + destaddr += (pScrn->bitsPerPixel/8)-1; } sisSETSRCADDR(srcaddr); @@ -251,64 +242,65 @@ SiSSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, static void SiSSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, - int fg, int bg, int rop, unsigned int planemask) + int fg, int bg, int rop, unsigned int planemask) { SISPtr pSiS = SISPTR(pScrn); - unsigned int *patternRegPtr ; - int i ; - int dstpitch; - int mix = XAAHelpPatternROP(pScrn, &fg, &bg, planemask, &rop); - int isTransparent = ( bg == -1 ); + unsigned int *patternRegPtr; + int i ; + int dstpitch; + int mix = XAAHelpPatternROP(pScrn, &fg, &bg, planemask, &rop); + int isTransparent = (bg == -1); dstpitch = pScrn->displayWidth * pScrn->bitsPerPixel / 8 ; - sisSETFGCOLOR(fg); sisSETBGCOLOR(bg); + sisSETFGCOLOR(fg); sisSETROPFG(rop); if (!isTransparent) { - sisSETROPBG(0xcc); /* copy */ + sisSETROPBG(0xcc); /* copy */ } else { - sisSETROPBG(0xAA); /* dst */ + sisSETROPBG(0xAA); /* dst */ } sisSETPITCH(0, dstpitch); sisSETSRCADDR(0); patternRegPtr = (unsigned int *)sisSETPATREG(); pSiS->sisPatternReg[0] = pSiS->sisPatternReg[2] = patternx ; pSiS->sisPatternReg[1] = pSiS->sisPatternReg[3] = patterny ; - for ( i = 0 ; i < 16 /* sisPatternHeight */ ; ) { - patternRegPtr[i++] = patternx ; - patternRegPtr[i++] = patterny ; - } + for ( i = 0 ; i < 16 /* sisPatternHeight */ ; ) { + patternRegPtr[i++] = patternx ; + patternRegPtr[i++] = patterny ; + } } static void SiSSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, - int patterny, int x, int y, int w, int h) + int patterny, int x, int y, int w, int h) { SISPtr pSiS = SISPTR(pScrn); - int dstaddr; - register unsigned char *patternRegPtr ; - register unsigned char *srcPatternRegPtr ; - register unsigned int *patternRegPtrL ; - int i, k ; - unsigned short tmp; - int shift ; - int op = sisCMDCOLEXP | sisTOP2BOTTOM | sisLEFT2RIGHT | - sisPATFG | sisSRCBG ; - if (pSiS->ClipEnabled) op |= sisCLIPINTRN | sisCLIPENABL; + int dstaddr; + register unsigned char *patternRegPtr ; + register unsigned char *srcPatternRegPtr ; + register unsigned int *patternRegPtrL ; + int i, k ; + unsigned short tmp; + int shift ; + int op = sisCMDCOLEXP | sisTOP2BOTTOM | sisLEFT2RIGHT | + sisPATFG | sisSRCBG ; + if (pSiS->ClipEnabled) + op |= sisCLIPINTRN | sisCLIPENABL; dstaddr = ( y * pScrn->displayWidth + x ) * pScrn->bitsPerPixel / 8; patternRegPtr = sisSETPATREG(); srcPatternRegPtr = (unsigned char *)pSiS->sisPatternReg ; - shift = 8-patternx ; + shift = 8 - patternx ; for ( i = 0, k = patterny ; i < 8 ; i++, k++ ) { - tmp = srcPatternRegPtr[k]<<8 | srcPatternRegPtr[k] ; - tmp >>= shift ; - patternRegPtr[i] = tmp & 0xff ; + tmp = srcPatternRegPtr[k]<<8 | srcPatternRegPtr[k] ; + tmp >>= shift ; + patternRegPtr[i] = tmp & 0xff ; } patternRegPtrL = (unsigned int *)sisSETPATREG(); - for ( i = 2 ; i < 16 /* sisPatternHeight */; ) { - patternRegPtrL[i++] = patternRegPtrL[0]; - patternRegPtrL[i++] = patternRegPtrL[1]; + for ( i = 2 ; i < 16 /* sisPatternHeight */; ) { + patternRegPtrL[i++] = patternRegPtrL[0]; + patternRegPtrL[i++] = patternRegPtrL[1]; } sisSETDSTADDR(dstaddr); @@ -321,11 +313,11 @@ SiSSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, */ static void SiSSetupForScreenToScreenColorExpandFill (ScrnInfoPtr pScrn, - int fg, int bg, - int rop, unsigned int planemask) + int fg, int bg, + int rop, unsigned int planemask) { SISPtr pSiS = SISPTR(pScrn); - int isTransparent = ( bg == -1 ); + int isTransparent = (bg == -1); /*ErrorF("SISSetupScreenToScreenColorExpand()\n");*/ @@ -335,15 +327,15 @@ SiSSetupForScreenToScreenColorExpandFill (ScrnInfoPtr pScrn, /* becareful with rop */ if (isTransparent) { - sisSETBGCOLOR(bg); - sisSETFGCOLOR(fg); - sisSETROPFG(0xf0); /* pat copy */ - sisSETROPBG(0xAA); /* dst */ + sisSETBGCOLOR(bg); + sisSETFGCOLOR(fg); + sisSETROPFG(0xf0); /* pat copy */ + sisSETROPBG(0xAA); /* dst */ } else { - sisSETBGCOLOR(bg); - sisSETFGCOLOR(fg); - sisSETROPFG(0xf0); /* pat copy */ - sisSETROPBG(0xcc); /* copy */ + sisSETBGCOLOR(bg); + sisSETFGCOLOR(fg); + sisSETROPFG(0xf0); /* pat copy */ + sisSETROPBG(0xcc); /* copy */ } } @@ -352,8 +344,8 @@ SiSSetupForScreenToScreenColorExpandFill (ScrnInfoPtr pScrn, */ static void SiSSubsequentScreenToScreenColorExpandFill( ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int srcx, int srcy, int offset ) + int x, int y, int w, int h, + int srcx, int srcy, int offset ) /* Offset needs to be taken into account. By now, is not used */ { SISPtr pSiS = SISPTR(pScrn); @@ -363,10 +355,11 @@ SiSSubsequentScreenToScreenColorExpandFill( ScrnInfoPtr pScrn, int srcpitch ; int ww ; int widthTodo ; - int op ; + int op ; op = sisCMDCOLEXP | sisTOP2BOTTOM | sisLEFT2RIGHT | sisPATFG | sisSRCBG | sisCMDENHCOLEXP ; - if (pSiS->ClipEnabled) op |= sisCLIPINTRN | sisCLIPENABL; + if (pSiS->ClipEnabled) + op |= sisCLIPINTRN | sisCLIPENABL; /* ErrorF("SISSubsequentScreenToScreenColorExpand()\n"); */ @@ -379,27 +372,27 @@ SiSSubsequentScreenToScreenColorExpandFill( ScrnInfoPtr pScrn, sisSETPITCH(srcpitch, destpitch); widthTodo = w ; do { - ww = widthTodo < maxWidth ? widthTodo : maxWidth ; - sisSETDSTADDR(destaddr); - sisSETSRCADDR(srcaddr); - sisSETHEIGHTWIDTH(h-1, ww*(pScrn->bitsPerPixel / 8)-1); - sisSETCMD(op); - srcaddr += ww ; - destaddr += ww*pScrn->bitsPerPixel / 8 ; - widthTodo -= ww ; + ww = widthTodo < maxWidth ? widthTodo : maxWidth ; + sisSETDSTADDR(destaddr); + sisSETSRCADDR(srcaddr); + sisSETHEIGHTWIDTH(h-1, ww*(pScrn->bitsPerPixel / 8)-1); + sisSETCMD(op); + srcaddr += ww ; + destaddr += ww*pScrn->bitsPerPixel / 8 ; + widthTodo -= ww ; } while ( widthTodo > 0 ) ; SiSSync(pScrn); } static void SiSSetClippingRectangle ( ScrnInfoPtr pScrn, - int left, int top, int right, int bottom) + int left, int top, int right, int bottom) { SISPtr pSiS = SISPTR(pScrn); sisSETCLIPTOP(left,top); sisSETCLIPBOTTOM(right,bottom); pSiS->ClipEnabled = TRUE; - + } static void SiSDisableClipping (ScrnInfoPtr pScrn) @@ -409,38 +402,45 @@ static void SiSDisableClipping (ScrnInfoPtr pScrn) } static void SiSSetupForSolidLine(ScrnInfoPtr pScrn, - int color, int rop, unsigned int planemask) + int color, int rop, unsigned int planemask) { SISPtr pSiS = SISPTR(pScrn); sisSETFGCOLOR(color); sisSETBGCOLOR(0); - sisSETROP(XAACopyROP[rop]); /* dst */ + sisSETROP(XAACopyROP[rop]); /* dst */ } static void SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, int flags) + int x1, int y1, int x2, int y2, int flags) { SISPtr pSiS = SISPTR(pScrn); - int op ; + int op ; int major, minor, err,K1,K2, tmp; - op = sisCMDLINE | sisSRCFG; - if ((flags & OMIT_LAST)) op |= sisLASTPIX ; - if (pSiS->ClipEnabled) op |= sisCLIPINTRN | sisCLIPENABL; + op = sisCMDLINE | sisSRCFG; + if ((flags & OMIT_LAST)) + op |= sisLASTPIX; + if (pSiS->ClipEnabled) + op |= sisCLIPINTRN | sisCLIPENABL; if ((major = x2 - x1) <= 0) { major = -major; - } else op |= sisXINCREASE;; + } else + op |= sisXINCREASE;; if ((minor = y2 - y1) <= 0) { minor = -minor; - } else op |= sisYINCREASE; - if(minor >= major){ - tmp = minor; minor = major; major = tmp; + } else + op |= sisYINCREASE; + if (minor >= major) { + tmp = minor; + minor = major; + major = tmp; } - else op |= sisXMAJOR; + else + op |= sisXMAJOR; - K1 = (minor-major)<<1; + K1 = (minor - major)<<1; K2 = minor<<1; err = (minor<<1) - major; @@ -450,7 +450,7 @@ static void SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, sisSETLineErrorTerm((short)err); sisSETLineMajorCount((short)major); sisSETCMD(op); -/* SiSSync(pScrn);*/ +/* SiSSync(pScrn);*/ } @@ -462,20 +462,19 @@ static void SiSSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, destaddr = y * pScrn->displayWidth + x; op = sisCMDBLT | sisSRCFG | sisTOP2BOTTOM | sisLEFT2RIGHT; - if (pSiS->ClipEnabled) op |= sisCLIPINTRN | sisCLIPENABL; + if (pSiS->ClipEnabled) + op |= sisCLIPINTRN | sisCLIPENABL; destaddr *= (pScrn->bitsPerPixel / 8); sisSETPITCH(pScrn->displayWidth * pScrn->bitsPerPixel / 8, - pScrn->displayWidth * pScrn->bitsPerPixel / 8); + pScrn->displayWidth * pScrn->bitsPerPixel / 8); - if(dir == DEGREES_0) + if(dir == DEGREES_0) sisSETHEIGHTWIDTH(0, len * (pScrn->bitsPerPixel>>3)-1); else sisSETHEIGHTWIDTH(len-1, (pScrn->bitsPerPixel>>3)-1 ); - sisSETDSTADDR(destaddr); - sisSETCMD(op); + sisSETCMD(op); SiSSync(pScrn); } - 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 d3f164ee1..44c1fe20f 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.5 2000/04/07 03:57:52 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c,v 1.8 2001/04/19 14:11:37 alanh Exp $ */ #include "xf86.h" #include "xf86PciInfo.h" @@ -8,1427 +8,4556 @@ #include "sis_bios.h" -static unsigned short ModeIDOffset, FRateOffset, - CRTC1Offset, VCLKOffset; -static unsigned char * CRTC2Ptr; -static unsigned short VBInfo, SetFlag, ModeType; -static unsigned char LCDResInfo, LCDTypeInfo, LCDInfo; -static unsigned short RVBHRS; -static unsigned short HDE, VGAHDE, VDE, VGAVDE; -static unsigned short HT, VGAHT, VT, VGAVT; -static unsigned char NewFlickerMode, RY1COE, RY2COE, RY3COE, RY4COE; -static unsigned short RVBHCMAX; -static unsigned char RVBHCFACT; - - - - - - - - - - -static unsigned short StResInfo[][2] = {{640,400},{640,350},{720,400}, - {720,350},{640,480}}; -static unsigned short ModeResInfo[][4] = { - { 320, 200,8, 8},{ 320, 240,8, 8},{ 320, 400,8, 8}, - { 400, 300,8, 8},{ 512, 384,8, 8},{ 640, 400,8,16}, - { 640, 480,8,16},{ 800, 600,8,16},{1024, 768,8,16}, - {1280,1024,8,16},{1600,1200,8,16},{1920,1440,8,16}, - { 720, 480,8,16},{ 720, 576,8,16},{2048,1536,8,16}}; - -static unsigned char StLCD1Data[][8] = { - LCDDATA(66, 31, 992, 510, 1320, 816), - LCDDATA(66, 31, 992, 510, 1320, 816), - LCDDATA(176, 75, 900, 510, 1320, 816), - LCDDATA(176, 75, 900, 510, 1320, 816), - LCDDATA(66, 31, 992, 510, 1320, 816), - LCDDATA(27, 16, 1024, 650, 1350, 832), - LCDDATA(1, 1, 1344, 806, 1344, 806)}; -static unsigned char ExtLCD1Data[][8] = { - LCDDATA(12,5,896,512,1344,806), - LCDDATA(12,5,896,510,1344,806), - LCDDATA(32,15,1008,505,1344,806), - LCDDATA(32,15,1008,514,1344,806), - LCDDATA(12,5,896,500,1344,806), - LCDDATA(42,25,1024,625,1344,806), - LCDDATA(1,1,1344,806,1344,806), - LCDDATA(12,5,896,500,1344,806), - LCDDATA(42,25,1024,625,1344,806), - LCDDATA(1,1,1344,806,1344,806), - LCDDATA(12,5,896,500,1344,806), - LCDDATA(42,25,1024,625,1344,806), - LCDDATA(1,1,1344,806,1344,806)}; - -static unsigned char StLCD2Data[][8] = { - LCDDATA(4,1,880,510,1650,1088), - LCDDATA(4,1,880,510,1650,1088), - LCDDATA(176,45,900,510,1650,1088), - LCDDATA(176,45,900,510,1650,1088), - LCDDATA(4,1,880,510,1650,1088), - LCDDATA(13,5,1024,675,1560,1152), - LCDDATA(16,9,1266,804,1688,1072), - LCDDATA(1,1,1688,1066,1688,1066)}; -static unsigned char ExtLCD2Data[][8] = { - LCDDATA(211,60,1024,501,1688,1066), - LCDDATA(211,60,1024,508,1688,1066), - LCDDATA(211,60,1024,501,1688,1066), - LCDDATA(211,60,1024,508,1688,1066), - LCDDATA(211,60,1024,500,1688,1066), - LCDDATA(211,75,1024,625,1688,1066), - LCDDATA(211,120,1280,798,1688,1066), - LCDDATA(1,1,1688,1066,1688,1066)}; - -static unsigned char StPALData[][16] = { - TVDATA(1,1,864,525,1270,400,100,0,760,0xF4,0xFF,0x1C,0x22), - TVDATA(1,1,864,525,1270,350,100,0,760,0xF4,0xFF,0x1C,0x22), - TVDATA(1,1,864,525,1270,400,0,0,720,0xF4,0x0B,0x1C,0x0A), - TVDATA(1,1,864,525,1270,350,0,0,720,0xF4,0x0B,0x1C,0x0A), - TVDATA(1,1,864,525,1270,480,50,0,760,0xF4,0xFF,0x1C,0x22), - TVDATA(1,1,864,525,1270,600,50,0,0,0xF4,0xFF,0x1C,0x22)}; -static unsigned char ExtPALData[][16] = { - TVDATA(27,10,848,448,1270,530,50,0,50,0xF4,0xFF,0x1C,0x22), - TVDATA(108,35,848,398,1270,530,50,0,50,0xF4,0xFF,0x1C,0x22), - TVDATA(12,5,954,448,1270,530,50,0,50,0xF4,0x0B,0x1C,0x0A), - TVDATA(9,4,960,463,1644,438,50,0,50,0xF4,0x0B,0x1C,0x0A), - TVDATA(9,4,848,528,1270,530,0,0,50,0xF5,0xFB,0x1B,0x2A), - TVDATA(36,25,1060,648,1316,530,438,0,438,0xEB,0x05,0x25,0x16), - TVDATA(3,2,1080,619,1270,540,438,0,438,0xF3,0x02,0x1D,0x1C)}; - -static unsigned char StNTSCData[][16] = { - TVDATA(1,1,858,525,1270,400,50,0,760,0xF1,0x04,0x1F,0x18), - TVDATA(1,1,858,525,1270,350,50,0,640,0xF1,0x04,0x1F,0x18), - TVDATA(1,1,858,525,1270,400,0,0,720,0xF4,0x0B,0x1C,0x0A), - TVDATA(1,1,858,525,1270,350,0,0,720,0xF4,0x0B,0x1C,0x0A), - TVDATA(1,1,858,525,1270,480,0,0,760,0xF1,0x04,0x1F,0x18)}; -static unsigned char ExtNTSCData[][16] = { - TVDATA(143,65,858,443,1270,440,171,0,171,0xF1,0x04,0x1F,0x18), - TVDATA(88,35,858,393,1270,440,171,0,171,0xF1,0x04,0x1F,0x18), - TVDATA(143,70,924,443,1270,440,92,0,92,0xF4,0x0B,0x1C,0x0A), - TVDATA(143,70,924,393,1270,440,92,0,92,0xF4,0x0B,0x1C,0x0A), - TVDATA(143,76,836,523,1270,440,224,0,0,0xF1,0x05,0x1F,0x16), - TVDATA(143,120,1056,643,1288,440,0,1,0,0xF4,0x10,0x1C,0x00), - TVDATA(143,76,836,523,1270,440,0,1,0,0xE7,0x0E,0x29,0x04)}; - -static unsigned char StHiTVData[][12] = { - HITVDATA(1,1,892,563,720,800,0,0,0), - HITVDATA(1,1,892,563,720,700,0,0,0), - HITVDATA(1,1,892,563,721,800,0,0,0), - HITVDATA(1,1,892,563,720,700,0,0,0), - HITVDATA(1,1,892,563,720,960,0,0,0), - HITVDATA(10,3,1008,625,1632,960,0x143,1,0), - HITVDATA(25,12,1260,851,1632,960,0x032,0,0), - HITVDATA(5,4,1575,1124,1632,960,0x128,0,0)}; -static unsigned char ExtHiTVData[][12] = { - HITVDATA(3,1,840,563,1632,960,0,0,0), - HITVDATA(3,1,960,563,1632,960,0,0,0), - HITVDATA(3,1,840,483,1632,960,0,0,0), - HITVDATA(3,1,960,563,1632,960,0,0,0), - HITVDATA(3,1,1400,563,1632,960,0x166,1,0), - HITVDATA(10,3,1008,625,1632,960,0x143,1,0), - HITVDATA(25,12,1260,851,1632,960,0x032,0,0), - HITVDATA(5,4,1575,1124,1632,960,0x128,0,0)}; - -/* for group2 */ -static unsigned char HiTVTiming1[] = { - 0x20,0x53,0x2C,0x5F,0x08,0x31,0x3A,0x64, - 0x28,0x02,0x01,0x3D,0x06,0x3E,0x35,0x6D, - 0x06,0x14,0x3E,0x35,0x6D,0x00,0xC5,0x3F, - 0x64,0x90,0x33,0x8C,0x18,0x36,0x1B,0x13, - 0x2A,0xDE,0x2A,0x44,0x40,0x2A,0x44,0x40, - 0x8E,0x8E,0x8F,0x07,0x0B}; -static unsigned char HiTVTiming2[] = { - 0x92,0x0F,0x40,0x60,0x80,0x14,0x90,0x8C, - 0x60,0x14,0x1A,0xB0,0x4F}; -static unsigned short HiTVTiming3[] = {0x0027,0xFFFC,0x006A}; - -static unsigned char HiTVTimingSimu1[] = { - 0x20,0x53,0x2C,0x5F,0x08,0x31,0x3A,0x65, - 0x28,0x02,0x01,0x3D,0x06,0x3E,0x35,0x6D, - 0x06,0x14,0x3E,0x35,0x6D,0x00,0xC5,0x3F, - 0x65,0x90,0x7B,0xA8,0x03,0xF0,0x78,0x03, - 0x11,0x15,0x11,0xCF,0x10,0x11,0xCF,0x10, - 0x35,0x35,0x3C,0x69,0x1D}; -static unsigned char HiTVTimingSimu2[] = { - 0x92,0x0F,0x40,0x60,0x80,0x14,0x90,0x8C, - 0x60,0x04,0x77,0x72,0x5C}; -static unsigned short HiTVTimingSimu3[] = {0x000E,0xFFFC,0x002D}; - -static unsigned char NTSCTiming1[] = { - 0x17,0x1D,0x03,0x09,0x05,0x06,0x0C,0x0C, - 0x94,0x49,0x01,0x0A,0x06,0x0D,0x04,0x0A, - 0x06,0x14,0x0D,0x04,0x0A,0x00,0x85,0x1B, - 0x0C,0x50,0x00,0x99,0x00,0xEC,0x4A,0x17, - 0x88,0x00,0x4B,0x00,0x00,0xE2,0x00,0x02, - 0x03,0x0A,0x65,0x9D,0x08}; -static unsigned char NTSCTiming2[] = { - 0x92,0x8F,0x40,0x60,0x80,0x14,0x90,0x8C, - 0x60,0x14,0x50,0x00,0x40}; -static unsigned short NTSCTiming3[] = {0x0044,0x02DB,0x003B}; - -static unsigned char PALTiming1[] = { - 0x19,0x52,0x35,0x6E,0x04,0x38,0x3D,0x70, - 0x94,0x49,0x01,0x12,0x06,0x3E,0x35,0x6D, - 0x06,0x14,0x3E,0x35,0x6D,0x00,0x45,0x2B, - 0x70,0x50,0x00,0x97,0x00,0xD7,0x5D,0x17, - 0x88,0x00,0x45,0x00,0x00,0xE8,0x00,0x02, - 0x0D,0x00,0x68,0xB0,0x0B}; -static unsigned char PALTiming2[] = { - 0x92,0x8F,0x40,0x60,0x80,0x14,0x90,0x8C, - 0x60,0x14,0x63,0x00,0x40}; -static unsigned short PALTiming3[] = {0x003E,0x02E1,0x0028}; - -/* for group3 */ -static unsigned char HiTVGroup3Data[] = { - 0x00,0x1A,0x22,0x63,0x62,0x22,0x08,0x5F, - 0x05,0x21,0xB2,0xB2,0x55,0x77,0x2A,0xA6, - 0x25,0x2F,0x47,0xFA,0xC8,0xFF,0x8E,0x20, - 0x8C,0x6E,0x60,0x2E,0x58,0x48,0x72,0x44, - 0x56,0x36,0x4F,0x6E,0x3F,0x80,0x00,0x80, - 0x4F,0x7F,0x03,0xA8,0x7D,0x20,0x1A,0xA9, - 0x14,0x05,0x03,0x7E,0x64,0x31,0x14,0x75, - 0x18,0x05,0x18,0x05,0x4C,0xA8,0x01}; -static unsigned char HiTVGroup3Simu[] = { - 0x00,0x1A,0x22,0x63,0x62,0x22,0x08,0x95, - 0xDB,0x20,0xB8,0xB8,0x55,0x47,0x2A,0xA6, - 0x25,0x2F,0x47,0xFA,0xC8,0xFF,0x8E,0x20, - 0x8C,0x6E,0x60,0x15,0x26,0xD3,0xE4,0x11, - 0x56,0x36,0x4F,0x6E,0x3F,0x80,0x00,0x80, - 0x67,0x36,0x01,0x47,0x0E,0x10,0xBE,0xB4, - 0x01,0x05,0x03,0x7E,0x65,0x31,0x14,0x75, - 0x18,0x05,0x18,0x05,0x4C,0xA8,0x01}; -static unsigned char NTSCGroup3Data[] = { - 0x00,0x14,0x15,0x25,0x55,0x15,0x0B,0x89, - 0xD7,0x40,0xB0,0xB0,0xFF,0xC4,0x45,0xA6, - 0x25,0x2F,0x67,0xF6,0xBF,0xFF,0x8E,0x20, - 0x8C,0xDA,0x60,0x92,0xC8,0x55,0x8B,0x00, - 0x51,0x04,0x18,0x0A,0xF8,0x87,0x00,0x80, - 0x3B,0x3B,0x00,0xF0,0xF0,0x00,0xF0,0xF0, - 0x00,0x51,0x0F,0x0F,0x08,0x0F,0x08,0x6F, - 0x18,0x05,0x05,0x05,0x4C,0xAA,0x01}; -static unsigned char PALGroup3Data[] = { - 0x00,0x1A,0x22,0x63,0x62,0x22,0x08,0x85, - 0xC3,0x20,0xA4,0xA4,0x55,0x47,0x2A,0xA6, - 0x25,0x2F,0x47,0xFA,0xC8,0xFF,0x8E,0x20, - 0x8C,0xDC,0x60,0x92,0xC8,0x4F,0x85,0x00, - 0x56,0x36,0x4F,0x6E,0xFE,0x83,0x54,0x81, - 0x30,0x30,0x00,0xF3,0xF3,0x00,0xA2,0xA2, - 0x00,0x48,0xFE,0x7E,0x08,0x40,0x08,0x91, - 0x18,0x05,0x18,0x05,0x4C,0xA8,0x01}; - - - - -Bool -SiSSetMode(ScrnInfoPtr pScrn, unsigned short ModeNo) -{ - unsigned long temp; - unsigned char * ROMAddr = SISPTR(pScrn)->BIOS; - unsigned short BaseAddr = SISPTR(pScrn)->RelIO; - - temp=SearchModeID(ROMAddr,ModeNo); /* 2.Get ModeID Table */ - if(temp==0) return(0); - - GetVBInfo(BaseAddr,ROMAddr); /* add for CRT2 */ - ErrorF("VBInfo=0x%0X\nSetFlag=0x%0X\nModeType=0x%0X\n", - VBInfo, SetFlag, ModeType); - GetLCDResInfo(BaseAddr+CROFFSET); /* add for CRT2 */ +UShort DRAMType[17][5]={{0x0C,0x0A,0x02,0x40,0x39},{0x0D,0x0A,0x01,0x40,0x48}, + {0x0C,0x09,0x02,0x20,0x35},{0x0D,0x09,0x01,0x20,0x44}, + {0x0C,0x08,0x02,0x10,0x31},{0x0D,0x08,0x01,0x10,0x40}, + {0x0C,0x0A,0x01,0x20,0x34},{0x0C,0x09,0x01,0x08,0x32}, + {0x0B,0x08,0x02,0x08,0x21},{0x0C,0x08,0x01,0x08,0x30}, + {0x0A,0x08,0x02,0x04,0x11},{0x0B,0x0A,0x01,0x10,0x28}, + {0x09,0x08,0x02,0x02,0x01},{0x0B,0x09,0x01,0x08,0x24}, + {0x0B,0x08,0x01,0x04,0x20},{0x0A,0x08,0x01,0x02,0x10}, + {0x09,0x08,0x01,0x01,0x00}}; + +UShort MDA_DAC[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F}; + +UShort CGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F}; + +UShort EGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x05,0x15, + 0x20,0x30,0x24,0x34,0x21,0x31,0x25,0x35, + 0x08,0x18,0x0C,0x1C,0x09,0x19,0x0D,0x1D, + 0x28,0x38,0x2C,0x3C,0x29,0x39,0x2D,0x3D, + 0x02,0x12,0x06,0x16,0x03,0x13,0x07,0x17, + 0x22,0x32,0x26,0x36,0x23,0x33,0x27,0x37, + 0x0A,0x1A,0x0E,0x1E,0x0B,0x1B,0x0F,0x1F, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F}; + +UShort VGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x00,0x05,0x08,0x0B,0x0E,0x11,0x14,0x18, + 0x1C,0x20,0x24,0x28,0x2D,0x32,0x38,0x3F, + + 0x00,0x10,0x1F,0x2F,0x3F,0x1F,0x27,0x2F, + 0x37,0x3F,0x2D,0x31,0x36,0x3A,0x3F,0x00, + 0x07,0x0E,0x15,0x1C,0x0E,0x11,0x15,0x18, + 0x1C,0x14,0x16,0x18,0x1A,0x1C,0x00,0x04, + 0x08,0x0C,0x10,0x08,0x0A,0x0C,0x0E,0x10, + 0x0B,0x0C,0x0D,0x0F,0x10}; + +UShort ModeIndex_640x480[] = {0x2E, 0x44, 0x45, 0x62}; +UShort ModeIndex_720x480[] = {0x31, 0x33, 0x00, 0x35}; +UShort ModeIndex_720x576[] = {0x32, 0x34, 0x00, 0x36}; +UShort ModeIndex_800x600[] = {0x30, 0x47, 0x48, 0x63}; +UShort ModeIndex_1024x768[] = {0x38, 0x4A, 0x4B, 0x64}; +UShort ModeIndex_1280x1024[] = {0x3A, 0x4D, 0x4E, 0x65}; +UShort ModeIndex_1600x1200[] = {0x3C, 0x3D, 0x3E, 0x66}; +UShort RefreshRate[7][8] = { + {60, 72, 75, 85, 100, 120, 160, 200}, + {56, 60, 72, 75, 85, 100, 120, 160}, + {43, 60, 70, 75, 85, 100, 120, 0}, + {43, 60, 75, 85, 0, 0, 0, 0}, + {60, 65, 70, 75, 85, 0, 0, 0}, + {60, 0 , 0 , 0 , 0 , 0 , 0 , 0 }, + {60, 0 , 0 , 0 , 0 , 0 , 0 , 0 }}; + +UShort StResInfo[5][2]={{640,400},{640,350},{720,400},{720,350},{640,480}}; +UShort ModeResInfo[15][4]={{320,200,8,8},{320,240,8,8},{320,400,8,8}, + {400,300,8,8},{512,384,8,8},{640,400,8,16}, + {640,480,8,16},{800,600,8,16},{1024,768,8,16}, + {1280,1024,8,16},{1600,1200,8,16},{1920,1440,8,16}, + {720,480,8,16},{720,576,8,16},{1280,960,8,16}}; + +UShort HiTVExtTiming[61]={0x32,0x65,0x2C,0x5F,0x08,0x31,0x3A,0x64, + 0x28,0x02,0x01,0x3D,0x06,0x3E,0x35,0x6D, + 0x06,0x14,0x3E,0x35,0x6D,0x00,0xC5,0x3F, + 0x64,0x90,0x33,0x8C,0x18,0x36,0x3E,0x13, + 0x2A,0xDE,0x2A,0x44,0x40,0x2A,0x44,0x40, + 0x8E,0x8E,0x82,0x07,0x0B, + 0x92,0x0F,0x40,0x60,0x80,0x14,0x90,0x8C, + 0x60,0x14,0x3D,0x63,0x4F, + 0x027,0xFFFC,0x6A}; + +UShort HiTVSt1Timing[61]={0x32,0x65,0x2C,0x5F,0x08,0x31,0x3A,0x65, + 0x28,0x02,0x01,0x3D,0x06,0x3E,0x35,0x6D, + 0x06,0x14,0x3E,0x35,0x6D,0x00,0xC5,0x3F, + 0x65,0x90,0x7B,0xA8,0x03,0xF0,0x87,0x03, + 0x11,0x15,0x11,0xCF,0x10,0x11,0xCF,0x10, + 0x35,0x35,0x3B,0x69,0x1D, + 0x92,0x0F,0x40,0x60,0x80,0x14,0x90,0x8C, + 0x60,0x04,0x86,0xAF,0x5D, + 0xE,0xFFFC,0x2D}; + +UShort HiTVSt2Timing[61]={0x32,0x65,0x2C,0x5F,0x08,0x31,0x3A,0x64, + 0x28,0x02,0x01,0x3D,0x06,0x3E,0x35,0x6D, + 0x06,0x14,0x3E,0x35,0x6D,0x00,0xC5,0x3F, + 0x64,0x90,0x33,0x8C,0x18,0x36,0x3E,0x13, + 0x2A,0xDE,0x2A,0x44,0x40,0x2A,0x44,0x40, + 0x8E,0x8E,0x82,0x07,0x0B, + 0x92,0x0F,0x40,0x60,0x80,0x14,0x90,0x8C, + 0x60,0x14,0x3D,0x63,0x4F, + 0x27,0xFFFC,0x6A}; + +UShort HiTVTextTiming[61]={0x32,0x65,0x2C,0x5F,0x08,0x31,0x3A,0x65, + 0x28,0x02,0x01,0x3D,0x06,0x3E,0x35,0x6D, + 0x06,0x14,0x3E,0x35,0x6D,0x00,0xC5,0x3F, + 0x65,0x90,0xE7,0xBC,0x03,0x0C,0x97,0x03, + 0x14,0x78,0x14,0x08,0x20,0x14,0x08,0x20, + 0xC8,0xC8,0x3B,0xD2,0x26, + 0x92,0x0F,0x40,0x60,0x80,0x14,0x90,0x8C, + 0x60,0x04,0x96,0x72,0x5C, + 0x11,0xFFFC,0x32}; + +UShort HiTVGroup3Data[63]={0x00,0x1A,0x22,0x63,0x62,0x22,0x08,0x5F, + 0x05,0x21,0xB2,0xB2,0x55,0x77,0x2A,0xA6, + 0x25,0x2F,0x47,0xFA,0xC8,0xFF,0x8E,0x20, + 0x8C,0x6E,0x60,0x2E,0x58,0x48,0x72,0x44, + 0x56,0x36,0x4F,0x6E,0x3F,0x80,0x00,0x80, + 0x4F,0x7F,0x03,0xA8,0x7D,0x20,0x1A,0xA9, + 0x14,0x05,0x03,0x7E,0x64,0x31,0x14,0x75, + 0x18,0x05,0x18,0x05,0x4C,0xA8,0x01}; + +UShort HiTVGroup3Simu[63]={0x00,0x1A,0x22,0x63,0x62,0x22,0x08,0x95, + 0xDB,0x20,0xB8,0xB8,0x55,0x47,0x2A,0xA6, + 0x25,0x2F,0x47,0xFA,0xC8,0xFF,0x8E,0x20, + 0x8C,0x6E,0x60,0x15,0x26,0xD3,0xE4,0x11, + 0x56,0x36,0x4F,0x6E,0x3F,0x80,0x00,0x80, + 0x67,0x36,0x01,0x47,0x0E,0x10,0xBE,0xB4, + 0x01,0x05,0x03,0x7E,0x65,0x31,0x14,0x75, + 0x18,0x05,0x18,0x05,0x4C,0xA8,0x01}; + +UShort HiTVGroup3Text[63]={0x00,0x1A,0x22,0x63,0x62,0x22,0x08,0xA7, + 0xF5,0x20,0xCE,0xCE,0x55,0x47,0x2A,0xA6, + 0x25,0x2F,0x47,0xFA,0xC8,0xFF,0x8E,0x20, + 0x8C,0x6E,0x60,0x18,0x2C,0x0C,0x20,0x22, + 0x56,0x36,0x4F,0x6E,0x3F,0x80,0x00,0x80, + 0x93,0x3C,0x01,0x50,0x2F,0x10,0xF4,0xCA, + 0x01,0x05,0x03,0x7E,0x65,0x31,0x14,0x75, + 0x18,0x05,0x18,0x05,0x4C,0xA8,0x01}; + + +UShort NTSCTiming[61]={0x017,0x01D,0x003,0x009,0x005,0x006,0x00C,0x00C, + 0x094,0x049,0x001,0x00A,0x006,0x00D,0x004,0x00A, + 0x006,0x014,0x00D,0x004,0x00A,0x000,0x085,0x01B, + 0x00C,0x050,0x000,0x099,0x000,0x0EC,0x04A,0x017, + 0x088,0x000,0x04B,0x000,0x000,0x0E2,0x000,0x002, + 0x003,0x00A,0x065,0x09D,0x008, + 0x092,0x08F,0x040,0x060,0x080,0x014,0x090,0x08C, + 0x060,0x014,0x050,0x000,0x040, + 0x00044,0x002DB,0x0003B}; /* Ajust xxx */ + +UShort PALTiming[61]={ 0x019,0x052,0x035,0x06E,0x004,0x038,0x03D,0x070, + 0x094,0x049,0x001,0x012,0x006,0x03E,0x035,0x06D, + 0x006,0x014,0x03E,0x035,0x06D,0x000,0x045,0x02B, + 0x070,0x050,0x000,0x097,0x000,0x0D7,0x05D,0x017, + 0x088,0x000,0x045,0x000,0x000,0x0E8,0x000,0x002, + 0x00D,0x000,0x068,0x0B0,0x00B, + 0x092,0x08F,0x040,0x060,0x080,0x014,0x090,0x08C, + 0x060,0x014,0x063,0x000,0x040, + 0x0003E,0x002E1,0x00028}; /* Ajust xxx */ + +UShort NTSCGroup3Data[63]= {0x000,0x014,0x015,0x025,0x055,0x015,0x00B,0x089, + 0x0D7,0x040,0x0B0,0x0B0,0x0FF,0x0C4,0x045,0x0A6, + 0x025,0x02F,0x067,0x0F6,0x0BF,0x0FF,0x08E,0x020, + 0x08C,0x0DA,0x060,0x092,0x0C8,0x055,0x08B,0x000, + 0x051,0x004,0x018,0x00A,0x0F8,0x087,0x000,0x080, + 0x03B,0x03B,0x000,0x0F0,0x0F0,0x000,0x0F0,0x0F0, + 0x000,0x051,0x00F,0x00F,0x008,0x00F,0x008,0x06F, + 0x018,0x005,0x005,0x005,0x04C,0x0AA,0x001}; + +UShort PALGroup3Data[63]={0x000,0x01A,0x022,0x063,0x062,0x022,0x008,0x085, + 0x0C3,0x020,0x0A4,0x0A4,0x055,0x047,0x02A,0x0A6, + 0x025,0x02F,0x047,0x0FA,0x0C8,0x0FF,0x08E,0x020, + 0x08C,0x0DC,0x060,0x092,0x0C8,0x04F,0x085,0x000, + 0x056,0x036,0x04F,0x06E,0x0FE,0x083,0x054,0x081, + 0x030,0x030,0x000,0x0F3,0x0F3,0x000,0x0A2,0x0A2, + 0x000,0x048,0x0FE,0x07E,0x008,0x040,0x008,0x091, + 0x018,0x005,0x018,0x005,0x04C,0x0A8,0x001}; +UShort Part1[41]={0x30, 0x16, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3f, 0x30, 0x8c, 0xbc, 0x22, 0x1c, 0x05, 0xdf, + 0xf3, 0x16, 0x0a, 0x20, 0x89, 0x93, 0x00, 0x80, + 0x14, 0xf7, 0x58, 0x00, 0x00, 0x18, 0x28, 0x32, + 0x15, 0xff, 0xa0, 0x00, 0x01, 0x03, 0x2c, 0x11, + 0x92}; + +UShort P3c4,P3d4,P3c0,P3ce,P3c2,P3ca,P3c6,P3c7,P3c8,P3c9,P3da; +UShort CRT1VCLKLen; /*VCLKData table length of bytes of each entry*/ +UShort flag_clearbuffer; /*0: no clear frame buffer 1:clear frame buffer*/ +int RAMType; +int ModeIDOffset,StandTable,CRT1Table,ScreenOffset,VCLKData,MCLKData, ECLKData; +int REFIndex,ModeType; +UShort IF_DEF_LVDS; +UShort IF_DEF_HiVision; +UShort IF_DEF_CH7005; +UShort VBInfo, SetFlag,RVBHCFACT,RVBHCMAX,VGAVT,VGAHT,VT,HT,VGAVDE,VGAHDE; +UShort VDE,HDE,RVBHRS,NewFlickerMode,RY1COE,RY2COE,RY3COE,RY4COE; +UShort LCDResInfo,LCDTypeInfo,LCDInfo,VCLKLen; +UShort LCDHDES,LCDVDES; +UShort DDC_Port; +UShort DDC_Index; +UShort DDC_DataShift; +UShort DDC_DeviceAddr; +UShort DDC_Flag; +UShort DDC_ReadAddr; +UShort DDC_Buffer; + +static Bool SearchModeID(ULong ROMAddr, UShort ModeNo); +static Bool CheckMemorySize(ULong ROMAddr); +static void GetModePtr(ULong ROMAddr, UShort ModeNo); +static void SetSeqRegs(ULong ROMAddr); +static void SetMiscRegs(ULong ROMAddr); +static void SetCRTCRegs(ULong ROMAddr); +static void SetATTRegs(ULong ROMAddr); +static void SetGRCRegs(ULong ROMAddr); +static void ClearExt1Regs(void); +static Bool GetRatePtr(ULong ROMAddr, UShort ModeNo); +static void SetSync(ULong ROMAddr); +static void SetCRT1CRTC(ULong ROMAddr); +static void SetCRT1Offset(ULong ROMAddr); +static void SetCRT1VCLK(ULong ROMAddr); +static void SetCRT1ModeRegs(ULong ROMAddr, UShort ModeNo); +static void SetVCLKState(ULong ROMAddr, UShort ModeNo); +static void LoadDAC(ULong ROMAddr); +static void WriteDAC(UShort dl, UShort ah, UShort al, UShort dh); +static void DisplayOn(void); +static void DisplayOff(void); +static void SetReg3(UShort port, UShort data); +static UShort GetReg1(UShort port, UShort index); +static UShort GetReg2(UShort port); +static UShort GetModeIDLength(ULong ROMAddr, UShort ModeNo); +static UShort GetRefindexLength(ULong ROMAddr, UShort ModeNo); +static void SetInterlace(ULong ROMAddr, UShort ModeNo); +static void SetCRT1FIFO(ULong ROMAddr); +static UShort CalcDelay(ULong ROMAddr,UShort key); +static void SetCRT1FIFO2(ULong ROMAddr); +static UShort CalcDelay2(ULong ROMAddr,UShort key); +static void SetReg4(UShort port, ULong data); +static ULong GetReg3(UShort port); +static void SetPitch(ScrnInfoPtr pScrn, UShort BaseAddr); +static UShort CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode); +static UShort CalcRefreshRate(ScrnInfoPtr pScrn, DisplayModePtr mode); +static void WaitVertical(void); +static Bool SetCRT2Group(UShort BaseAddr,ULong ROMAddr,UShort ModeNo, ScrnInfoPtr pScrn); +static void SetDefCRT2ExtRegs(UShort BaseAddr); +static UShort GetRatePtrCRT2(ULong ROMAddr, UShort ModeNo); +static Bool AjustCRT2Rate(ULong ROMAddr); +static void SaveCRT2Info(UShort ModeNo); +static void DisableLockRegs(void); +static void DisableCRT2(void); +static void GetCRT2Data(ULong ROMAddr,UShort ModeNo); +static void GetCRT2DataLVDS(ULong ROMAddr,UShort ModeNo); +static void GetCRT2Data301(ULong ROMAddr,UShort ModeNo); +static void GetResInfo(ULong ROMAddr,UShort ModeNo); +static void GetLVDSDesData(ULong ROMAddr,UShort ModeNo); +static void GetRAMDAC2DATA(ULong ROMAddr,UShort ModeNo); +static void GetCRT2Ptr(ULong ROMAddr,UShort ModeNo); +static void SetCRT2ModeRegs(UShort BaseAddr,UShort ModeNo); +static void SetGroup1(UShort BaseAddr,ULong ROMAddr,UShort ModeNo, + ScrnInfoPtr pScrn); +static void SetGroup1_LVDS(UShort BaseAddr,ULong ROMAddr,UShort ModeNo, + ScrnInfoPtr pScrn); +static void SetTPData(void); +static void SetGroup1_301(UShort BaseAddr,ULong ROMAddr,UShort ModeNo,ScrnInfoPtr pScrn); +static void SetCRT2Offset(UShort Part1Port,ULong ROMAddr); +static UShort GetOffset(ULong ROMAddr); +static UShort GetColorDepth(ULong ROMAddr); +static void SetCRT2FIFO(UShort Part1Port,ULong ROMAddr,UShort ModeNo,ScrnInfoPtr pScrn); +static UShort GetVCLK(ULong ROMAddr,UShort ModeNo); +static UShort GetQueueConfig(void); +static UShort GetVCLKPtr(ULong ROMAddr,UShort ModeNo); +static UShort GetColorTh(ULong ROMAddr); +static UShort GetMCLK(ULong ROMAddr); +static UShort GetMCLKPtr(ULong ROMAddr); +static UShort GetDRAMType(ULong ROMAddr); +static UShort CalcDelayVB(void); +static UShort GetVCLK2Ptr(ULong ROMAddr,UShort ModeNo); +static UShort GetVCLKLen(ULong ROMAddr); +static void SetCRT2Sync(UShort BaseAddr,ULong ROMAddr,UShort ModeNo); +static void GetCRT1Ptr(ULong ROMAddr); +static void SetRegANDOR(UShort Port,UShort Index,UShort DataAND,UShort DataOR); +static UShort GetVGAHT2(void); +static void SetGroup2(UShort BaseAddr,ULong ROMAddr, UShort ModeNo); +static void SetGroup3(UShort BaseAddr,ULong ROMAddr); +static void SetGroup4(UShort BaseAddr,ULong ROMAddr,UShort ModeNo); +static void SetCRT2VCLK(UShort BaseAddr,ULong ROMAddr,UShort ModeNo); +static void SetGroup5(UShort BaseAddr,ULong ROMAddr); +static void EnableCRT2(void); +static void LoadDAC2(ULong ROMAddr,UShort Part5Port); +static void WriteDAC2(UShort Pdata,UShort dl, UShort ah, UShort al, UShort dh); +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 GetLCDDDCInfo(ScrnInfoPtr pScrn); +static void SetTVSystem(void); +static void LongWait(void); +static void VBLongWait(void); +static Bool WaitVBRetrace(UShort BaseAddr); +static void ModCRT1CRTC(ULong ROMAddr,UShort ModeNo); +static void SetCRT2ECLK(ULong ROMAddr, UShort ModeNo); +static UShort GetLVDSDesPtr(ULong ROMAddr,UShort ModeNo); +static Bool GetLVDSCRT1Ptr(ULong ROMAddr,UShort ModeNo); +static void SetCHTVReg(ULong ROMAddr,UShort ModeNo); +static void SetCHTVRegANDOR(UShort tempax,UShort tempbh); +static void GetCHTVRegPtr(ULong ROMAddr,UShort ModeNo); +static void SetSwitchDDC2(void); +static void SetStart(void); +static void SetStop(void); +static UShort WriteDDC2Data(UShort tempax); +static UShort ReadDDC2Data(UShort tempax); +static void SetSCLKLow(void); +static void SetSCLKHigh(void); +static void DDC2Delay(void); +static UShort CheckACK(void); + +Bool SiSSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + SISPtr pSiS = SISPTR(pScrn); + ULong temp; + UShort cr30flag,cr31flag; + ULong ROMAddr = (ULong) SISPTR(pScrn)->BIOS; + UShort BaseAddr = (UShort) (SISPTR(pScrn)->RelIO +0x30); + UShort ModeNo=0; + UShort Rate; + + P3c4=BaseAddr+0x14; + P3d4=BaseAddr+0x24; + P3c0=BaseAddr+0x10; + P3ce=BaseAddr+0x1e; + P3c2=BaseAddr+0x12; + P3ca=BaseAddr+0x1a; + P3c6=BaseAddr+0x16; + P3c7=BaseAddr+0x17; + P3c8=BaseAddr+0x18; + P3c9=BaseAddr+0x19; + P3da=BaseAddr+0x2A; + + ModeNo = CalcModeIndex(pScrn, mode); + Rate = CalcRefreshRate(pScrn, mode); + SetReg1(P3d4, 0x33, Rate); + + SetReg1(P3c4, 0x20, 0xa1); + SetReg1(P3c4, 0x1E, 0x5A); + + if(pSiS->VBFlags & VB_LVDS) + IF_DEF_LVDS = 1; + else + IF_DEF_LVDS = 0; + if(pSiS->VBFlags & VB_CHRONTEL) + IF_DEF_CH7005 = 1; + else + IF_DEF_CH7005 = 0; + + +/* ynlai begin */ + IF_DEF_HiVision=0; +/* ynlai end */ + + PresetScratchregister(P3d4); /* add for CRT2 */ + /* replace GetSenseStatus,SetTVSystem,SetDisplayInfo */ + + DisplayOff(); + SetReg1(P3c4,0x05,0x86); /* 1.Openkey */ + temp=SearchModeID(ROMAddr,ModeNo); /* 2.Get ModeID Table */ + if(temp==0) return(0); + + /* SetTVSystem(); */ /* add for CRT2 */ + /*GetLCDDDCInfo(pScrn);*/ /* add for CRT2 */ + GetVBInfo(BaseAddr,ROMAddr); /* add for CRT2 */ + GetLCDResInfo(ROMAddr, P3d4); /* add for CRT2 */ + + temp=CheckMemorySize(ROMAddr); /* 3.Check memory size */ + if(temp==0) return(0); + cr30flag=(UChar)GetReg1(P3d4,0x30); + if(((cr30flag&0x01)==1)||((cr30flag&0x02)==0)){ + /* if cr30 d[0]=1 or d[1]=0 set crt1 */ + SetReg1(P3d4,0x34,ModeNo); + /* set CR34->CRT1 ModeNofor CRT2 FIFO */ + GetModePtr(ROMAddr,ModeNo); /* 4.GetModePtr */ + SetSeqRegs(ROMAddr); /* 5.SetSeqRegs */ + SetMiscRegs(ROMAddr); /* 6.SetMiscRegs */ + SetCRTCRegs(ROMAddr); /* 7.SetCRTCRegs */ + SetATTRegs(ROMAddr); /* 8.SetATTRegs */ + SetGRCRegs(ROMAddr); /* 9.SetGRCRegs */ + ClearExt1Regs(); /* 10.Clear Ext1Regs */ + temp=GetRatePtr(ROMAddr,ModeNo); /* 11.GetRatePtr */ + if(temp) { + SetSync(ROMAddr); /* 12.SetSync */ + SetCRT1CRTC(ROMAddr); /* 13.SetCRT1CRTC */ + SetCRT1Offset(ROMAddr); /* 14.SetCRT1Offset */ + SetCRT1VCLK(ROMAddr); /* 15.SetCRT1VCLK */ + SetVCLKState(ROMAddr, ModeNo); + if( (pSiS->Chipset == PCI_CHIP_SIS630) || (pSiS->Chipset == PCI_CHIP_SIS540) ) + SetCRT1FIFO2(ROMAddr); + else + SetCRT1FIFO(ROMAddr); + } + SetCRT1ModeRegs(ROMAddr, ModeNo); + if( (pSiS->Chipset == PCI_CHIP_SIS630) || (pSiS->Chipset == PCI_CHIP_SIS540) ) + SetInterlace(ROMAddr,ModeNo); + LoadDAC(ROMAddr); + } + cr31flag=(UChar)GetReg1(P3d4,0x31); + if(((cr30flag&0x01)==1)||((cr30flag&0x03)==0x02)|| + (((cr30flag&0x03)==0x00)&&((cr31flag&0x20)==0x20))) { + /* if CR30 d[0]=1 or d[1:0]=10, set CRT2 or cr30 cr31== 0x00 0x20 */ + SetCRT2Group(BaseAddr,ROMAddr,ModeNo, pScrn); /* add for CRT2 */ + } + +/* ynlai begin test */ +/* ynlai end test */ + + SetPitch(pScrn, BaseAddr); /* 16.SetPitch */ + WaitVertical(); + DisplayOn(); /* 17.DisplayOn */ + return TRUE; +} + +static Bool SearchModeID(ULong ROMAddr, UShort ModeNo) +{ + UChar ModeID; + UShort usIDLength; + + ModeIDOffset=*((UShort *)(ROMAddr+0x20A)); /* Get EModeIDTable */ + ModeID=*((UChar *)(ROMAddr+ModeIDOffset)); /* Offset 0x20A */ + usIDLength = GetModeIDLength(ROMAddr, ModeNo); + while(ModeID!=0xff && ModeID!=ModeNo) { +/* ModeIDOffset=ModeIDOffset+10; */ /*StructSize */ + ModeIDOffset=ModeIDOffset+usIDLength; + ModeID=*((UChar *)(ROMAddr+ModeIDOffset)); + } + if(ModeID==0xff) return(FALSE); + else return(TRUE); +} + +static Bool CheckMemorySize(ULong ROMAddr) +{ + UShort memorysize; + UShort modeflag; + UShort temp; + + modeflag=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + ModeType=modeflag&ModeInfoFlag; /* Get mode type */ + + memorysize=modeflag&MemoryInfoFlag; + memorysize=memorysize>MemorySizeShift; + memorysize++; /* Get memory size */ + + temp=GetReg1(P3c4,0x14); /* Get DRAM Size */ + temp=temp&0x3F; + temp++; + + if(temp<memorysize) return(FALSE); + else return(TRUE); +} - if (VBInfo & (SET_SIMU_SCAN_MODE | SWITCH_TO_CRT2)) - SetFlag |= PROGRAMMING_CRT2; +static void GetModePtr(ULong ROMAddr, UShort ModeNo) +{ + UChar index; + + StandTable=*((UShort *)(ROMAddr+0x202)); /* Get First 0x202 */ + /* StandTable Offset */ + if(ModeNo<=13) { + index=*((UChar *)(ROMAddr+ModeIDOffset+0x03)); /* si+St_ModeFlag */ + } + else { + if(ModeType <= 0x02) index=0x1B; /* 02 -> ModeEGA */ + else index=0x0F; + } + StandTable=StandTable+64*index; +} - /* Skip Set CRT1 Regs */ +static void SetSeqRegs(ULong ROMAddr) +{ + UChar SRdata; + UShort i; + + SetReg1(P3c4,0x00,0x03); /* Set SR0 */ + StandTable=StandTable+0x05; + SRdata=*((UChar *)(ROMAddr+StandTable)); /* Get SR01 from file */ + if(IF_DEF_LVDS==1){ + if(IF_DEF_CH7005==1) { + if(VBInfo&SetCRT2ToTV) { + if(VBInfo&SetInSlaveMode) { + SRdata=SRdata|0x01; + } + } + } + if(VBInfo&SetCRT2ToLCD){ + if(VBInfo&SetInSlaveMode){ + if(LCDInfo&LCDNonExpanding){ + SRdata=SRdata|0x01; + } + } + } + } + SRdata=SRdata|0x20; + SetReg1(P3c4,0x01,SRdata); /* Set SR1 */ + for(i=02;i<=04;i++) { + StandTable++; + SRdata=*((UChar *)(ROMAddr+StandTable)); /* Get SR2,3,4 from file */ + SetReg1(P3c4,i,SRdata); /* Set SR2 3 4 */ + } +} - if ((VBInfo & SET_SIMU_SCAN_MODE) || (VBInfo & SWITCH_TO_CRT2)) - SetCRT2Group(pScrn,ModeNo); /* add for CRT2 */ +static void SetMiscRegs(ULong ROMAddr) +{ + UChar Miscdata; - return TRUE; + StandTable++; + Miscdata=*((UChar *)(ROMAddr+StandTable)); /* Get Misc from file */ + SetReg3(P3c2,Miscdata); /* Set Misc(3c2) */ } -Bool -SearchModeID(unsigned char *ROMAddr, unsigned short ModeNo) +static void SetCRTCRegs(ULong ROMAddr) { - unsigned char ModeID; - unsigned short ModeIDLen; + UChar CRTCdata; + UShort i; + + CRTCdata=(UChar)GetReg1(P3d4,0x11); + CRTCdata=CRTCdata&0x7f; + SetReg1(P3d4,0x11,CRTCdata); /* Unlock CRTC */ + + for(i=0;i<=0x18;i++) { + StandTable++; + CRTCdata=*((UChar *)(ROMAddr+StandTable)); /* Get CRTC from file */ + SetReg1(P3d4,i,CRTCdata); /* Set CRTC(3d4) */ + } +} - if (ModeNo <= 0x13) { - ModeIDOffset=*(unsigned short *)(ROMAddr+0x200); - ModeIDLen = STMODE_SIZE; - } else { - ModeIDOffset=*(unsigned short *)(ROMAddr+0x20A); - ModeIDLen = EMODE_SIZE; - } +static void SetATTRegs(ULong ROMAddr) +{ + UChar ARdata; + UShort i; + + for(i=0;i<=0x13;i++) { + StandTable++; + ARdata=*((UChar *)(ROMAddr+StandTable)); /* Get AR for file */ + if(IF_DEF_LVDS==1){ /*for LVDS*/ + if(IF_DEF_CH7005==1) { + if(VBInfo&SetCRT2ToTV) { + if(VBInfo&SetInSlaveMode) { + if(i==0x13) ARdata=0; + } + } + } + if(VBInfo&SetCRT2ToLCD){ + if(VBInfo&SetInSlaveMode){ + if(i==0x13) ARdata=0; + } + } + } + GetReg2(P3da); /* reset 3da */ + SetReg3(P3c0,i); /* set index */ + SetReg3(P3c0,ARdata); /* set data */ + } + + GetReg2(P3da); /* reset 3da */ + SetReg3(P3c0,0x14); /* set index */ + SetReg3(P3c0,0x00); /* set data */ + GetReg2(P3da); /* Enable Attribute */ + SetReg3(P3c0,0x20); +} - ModeID=*(ROMAddr+ModeIDOffset); - while (ModeID!=0xff && ModeID!=ModeNo) { - ModeIDOffset += ModeIDLen; - ModeID=*(ROMAddr+ModeIDOffset); - } - if(ModeID==0xff) - return(FALSE); - else - return(TRUE); +static void SetGRCRegs(ULong ROMAddr) +{ + UChar GRdata; + UShort i; + + for(i=0;i<=0x08;i++) { + StandTable++; + GRdata=*((UChar *)(ROMAddr+StandTable)); /* Get GR from file */ + SetReg1(P3ce,i,GRdata); /* Set GR(3ce) */ + } + if(ModeType>ModeVGA){ + GRdata=(UChar)GetReg1(P3ce,0x05); + GRdata=GRdata&0xBF; + SetReg1(P3ce,0x05,GRdata); + } } -void -GetVBInfo(unsigned short BaseAddr, unsigned char *ROMAddr) +static void ClearExt1Regs() { - unsigned short flag; - unsigned short tempbx; - unsigned short tempbl,tempbh; - unsigned short p3c4 = BaseAddr + SROFFSET; - unsigned short p3d4 = BaseAddr + CROFFSET; - - SetFlag=0; - tempbx = *(CARD16 *)(ROMAddr+ModeIDOffset+1); /* si+St_ModeFlag */ - ModeType = tempbx & MODE_INFO_FLAG; - - inSISIDXREG(p3c4,0x38,flag); /* call BridgeisOn */ - if(!(flag & 0x20)){ - VBInfo = 0; - return; - } - inSISIDXREG(p3d4,0x30,tempbl); - inSISIDXREG(p3d4,0x31,tempbh); - tempbx = tempbh << 8 | tempbl; - tempbx &= (~(SET_IN_SLAVE_MODE | DISABLE_CRT2_DISPLAY) ); - if(!(tempbx & 0x07C)) { - VBInfo=SET_SIMU_SCAN_MODE | DISABLE_CRT2_DISPLAY; - return; - } - if (tempbx & SET_CRT2_TO_RAMDAC) { - tempbx &= (0xFF00 | SET_CRT2_TO_RAMDAC | SWITCH_TO_CRT2 | - SET_SIMU_SCAN_MODE); - } else if (tempbx & SET_CRT2_TO_LCD) { - tempbx &= (0xFF00 | SET_CRT2_TO_LCD | SWITCH_TO_CRT2 | - SET_SIMU_SCAN_MODE); - } else if (tempbl & SET_CRT2_TO_SCART) { - tempbx &=(0xFF00 | SET_CRT2_TO_SCART |SWITCH_TO_CRT2 | - SET_SIMU_SCAN_MODE); - } else if (tempbl & SET_CRT2_TO_HIVISION_TV) { - tempbx &= (0xFF00 | SET_CRT2_TO_HIVISION_TV | SWITCH_TO_CRT2 | - SET_SIMU_SCAN_MODE); - } - if ((tempbl & (DISABLE_CRT2_DISPLAY >> 8)) && - (tempbl & (SWITCH_TO_CRT2 | SET_SIMU_SCAN_MODE))==0) - tempbx = SET_SIMU_SCAN_MODE | DISABLE_CRT2_DISPLAY; - - if(!(tempbx & DRIVER_MODE)) - tempbx |= SET_SIMU_SCAN_MODE; - - if (!(tempbx & SET_SIMU_SCAN_MODE)) { - if (tempbx & SWITCH_TO_CRT2) { - flag = *(CARD16 *)(ROMAddr+ModeIDOffset+1); - if (!(flag & CRT2_MODE)) - tempbx |= SET_SIMU_SCAN_MODE; - } else { - if (BridgeIsEnable(BaseAddr) && BridgeInSlave(BaseAddr)) - tempbx |= SET_SIMU_SCAN_MODE; - } - } - /* GetVBInfoCnt */ - if (tempbx & DISABLE_CRT2_DISPLAY) { - VBInfo = tempbx; - return; - } - if (tempbx & DRIVER_MODE) { - if (!(tempbx & SET_SIMU_SCAN_MODE)) { - VBInfo = tempbx; - return; - } - flag = *(CARD16 *)(ROMAddr+ModeIDOffset+1); - if (flag & CRT2_MODE) { - VBInfo = tempbx; - return; - } - } - tempbx |= SET_IN_SLAVE_MODE; - if ((tempbx & SET_CRT2_TO_TV) && (!(tempbx & SET_NO_SIMU_TV_ON_LOCK))) - SetFlag |= TV_SIMU_MODE; - - VBInfo = tempbx; - return; -} - -Bool -BridgeIsEnable(CARD16 BaseAddr) -{ - unsigned char temp; - - if (!BridgeIsOn(BaseAddr)) - return FALSE; - inSISIDXREG(BaseAddr+P1_INDEX, 0, temp); - if (temp & 0xA0) - return TRUE; - else - return FALSE; -} - -Bool -BridgeIsOn(CARD16 BaseAddr) -{ - unsigned char temp; - - inSISIDXREG(BaseAddr+SROFFSET, 0x38, temp); - if (temp & 0x20) - return TRUE; - else - return FALSE; -} - -Bool -BridgeInSlave(CARD16 BaseAddr) -{ - unsigned char temp; - - inSISIDXREG(BaseAddr+CROFFSET, 0x31, temp); - if (temp & SET_IN_SLAVE_MODE) - return TRUE; - else - return FALSE; -} - -void -GetLCDResInfo(unsigned short p3d4) -{ - unsigned short tempah,tempbh; - - inSISIDXREG(p3d4, 0x36, tempbh); - tempah = tempbh & 0x0F; - - if (tempah > PANEL_1280x1024) - tempah = 0; - LCDResInfo = tempah; - LCDTypeInfo = tempbh >> 4; - inSISIDXREG(p3d4, 0x37, LCDInfo); - if(!(VBInfo & SET_CRT2_TO_LCD)) - return; - if (!(VBInfo & (SET_SIMU_SCAN_MODE | SWITCH_TO_CRT2))) - return; - if (VBInfo & SET_IN_SLAVE_MODE) { - if (VBInfo & SET_NO_SIMU_ON_LOCK) - SetFlag |= LCDVESA_TIMING; - } else - SetFlag |= LCDVESA_TIMING; -} - -void -SetCRT2Group(ScrnInfoPtr pScrn, CARD16 ModeNo) -{ - unsigned short temp; - SISPtr pSiS = SISPTR(pScrn); - unsigned short BaseAddr = pSiS->RelIO; - unsigned char * ROMAddr = pSiS->BIOS; - + UShort i; + + for(i=0x0A;i<=0x0E;i++) SetReg1(P3c4,i,0x00); /* Clear SR0A-SR0E */ +} + + +static Bool GetRatePtr(ULong ROMAddr, UShort ModeNo) +{ + short index; + UShort temp; + UShort ulRefIndexLength; + + if(ModeNo<0x14) return(FALSE); /* Mode No <= 13h then return */ + + index=GetReg1(P3d4,0x33); /* Get 3d4 CRTC33 */ + index=index&0x0F; /* Frame rate index */ + if(index!=0) index--; + REFIndex=*((UShort *)(ROMAddr+ModeIDOffset+0x04)); /* si+Ext_point */ + + ulRefIndexLength = GetRefindexLength(ROMAddr, ModeNo); + do { + temp=*((UShort *)(ROMAddr+REFIndex)); /* di => REFIndex */ + if(temp==0xFFFF) break; + temp=temp&ModeInfoFlag; + if(temp<ModeType) break; + + REFIndex=REFIndex+ulRefIndexLength; /* rate size */ + index--; + } while(index>=0); + + REFIndex=REFIndex-ulRefIndexLength; /* rate size */ + return(TRUE); +} + +static void SetSync(ULong ROMAddr) +{ + UShort sync; + UShort temp; + + sync=*((UShort *)(ROMAddr+REFIndex)); /* di+0x00 */ + sync=sync&0xC0; + temp=0x2F; + temp=temp|sync; + SetReg3(P3c2,temp); /* Set Misc(3c2) */ +} + +static void SetCRT1CRTC(ULong ROMAddr) +{ + UChar index; + UChar data; + UShort i; + + index=*((UChar *)(ROMAddr+REFIndex+0x02)) & 0x3F; /* Get index */ + CRT1Table=*((UShort *)(ROMAddr+0x204)); /* Get CRT1Table */ + CRT1Table=CRT1Table+index*CRT1Len; + + data=(UChar)GetReg1(P3d4,0x11); + data=data&0x7F; + SetReg1(P3d4,0x11,data); /* Unlock CRTC */ + + CRT1Table--; + for(i=0;i<=0x05;i++) { + CRT1Table++; + data=*((UChar *)(ROMAddr+CRT1Table)); + SetReg1(P3d4,i,data); + } + for(i=0x06;i<=0x07;i++) { + CRT1Table++; + data=*((UChar *)(ROMAddr+CRT1Table)); + SetReg1(P3d4,i,data); + } + for(i=0x10;i<=0x12;i++) { + CRT1Table++; + data=*((UChar *)(ROMAddr+CRT1Table)); + SetReg1(P3d4,i,data); + } + for(i=0x15;i<=0x16;i++) { + CRT1Table++; + data=*((UChar *)(ROMAddr+CRT1Table)); + SetReg1(P3d4,i,data); + } + for(i=0x0A;i<=0x0C;i++) { + CRT1Table++; + data=*((UChar *)(ROMAddr+CRT1Table)); + SetReg1(P3c4,i,data); + } + + CRT1Table++; + data=*((UChar *)(ROMAddr+CRT1Table)); + data=data&0xE0; + SetReg1(P3c4,0x0E,data); + + data=(UChar)GetReg1(P3d4,0x09); + data=data&0xDF; + i=*((UChar *)(ROMAddr+CRT1Table)); + i=i&0x01; + i=i<<5; + data=data|i; + i=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); + i=i&DoubleScanMode; + if(i) data=data|0x80; + SetReg1(P3d4,0x09,data); + + if(ModeType>0x03) SetReg1(P3d4,0x14,0x4F); +} + +static void SetCRT1Offset(ULong ROMAddr) +{ + UShort temp,ah,al; + UShort temp2,i; + UShort DisplayUnit; + + temp=*((UChar *)(ROMAddr+ModeIDOffset+0x03)); /* si+Ext_ModeInfo */ + temp=temp>>4; /* index */ + ScreenOffset=*((UShort *)(ROMAddr+0x206)); /* ScreenOffset */ + temp=*((UChar *)(ROMAddr+ScreenOffset+temp)); /* data */ + + temp2=*((UShort *)(ROMAddr+REFIndex+0x00)); + temp2=temp2&InterlaceMode; + if(temp2) temp=temp<<1; + temp2=ModeType-ModeEGA; + switch (temp2) { + case 0 : temp2=1; break; + case 1 : temp2=2; break; + case 2 : temp2=4; break; + case 3 : temp2=4; break; + case 4 : temp2=6; break; + case 5 : temp2=8; break; + } + temp=temp*temp2; + DisplayUnit=temp; + + temp2=temp; + temp=temp>>8; /* ah */ + temp=temp&0x0F; + i=GetReg1(P3c4,0x0E); + i=i&0xF0; + i=i|temp; + SetReg1(P3c4,0x0E,i); + + temp=(UChar)temp2; + temp=temp&0xFF; /* al */ + SetReg1(P3d4,0x13,temp); + + temp2=*((UShort *)(ROMAddr+REFIndex+0x00)); + temp2=temp2&InterlaceMode; + if(temp2) DisplayUnit>>=1; + + DisplayUnit=DisplayUnit<<5; + ah=(DisplayUnit&0xff00)>>8; + al=DisplayUnit&0x00ff; + if(al==0) ah=ah+1; + else ah=ah+2; + SetReg1(P3c4,0x10,ah); +} + +static void SetCRT1VCLK(ULong ROMAddr) +{ + UShort i; + UChar index,data; + + index=*((UChar *)(ROMAddr+REFIndex+0x03)) & 0x3F; + CRT1VCLKLen=GetVCLKLen(ROMAddr); + data=index*CRT1VCLKLen; + VCLKData=*((UShort *)(ROMAddr+0x208)); + VCLKData=VCLKData+data; + + SetReg1(P3c4,0x31,0); + for(i=0x2B;i<=0x2C;i++) { + data=*((UChar *)(ROMAddr+VCLKData)); + SetReg1(P3c4,i,data); + VCLKData++; + } + SetReg1(P3c4,0x2D,0x80); +} + + +static void SetCRT1ModeRegs(ULong ROMAddr, UShort ModeNo) +{ + UShort data,data2,data3; + + if(ModeNo>0x13) data=*((UShort *)(ROMAddr+REFIndex+0x00)); + else data=0; + data2=0; + if(ModeNo>0x13) + if(ModeType>0x02) { + data2=data2|0x02; + data3=ModeType-ModeVGA; + data3=data3<<2; + data2=data2|data3; + } + + data=data&InterlaceMode; + if(data) data2=data2|0x20; + SetReg1(P3c4,0x06,data2); + + data=GetReg1(P3c4,0x01); + data=data&0xF7; + data2=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); + data2=data2&HalfDCLK; + if(data2) data=data|0x08; + SetReg1(P3c4,0x01,data); + + data=GetReg1(P3c4,0x0F); + data=data&0xF7; + data2=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); + data2=data2&LineCompareOff; + if(data2) data=data|0x08; + SetReg1(P3c4,0x0F,data); + + data=GetReg1(P3c4,0x21); + data=data&0x1F; + if(ModeType==0x00) data=data|0x60; /* Text Mode */ + else if(ModeType<=0x02) data=data|0x00; /* EGA Mode */ + else data=data|0xA0; /* VGA Mode */ + SetReg1(P3c4,0x21,data); +} + +static void SetVCLKState(ULong ROMAddr, UShort ModeNo) +{ + UShort data,data2; + UShort VCLK; + UChar index; + + index=*((UChar *)(ROMAddr+REFIndex+0x03)); + CRT1VCLKLen=GetVCLKLen(ROMAddr); + data=index*CRT1VCLKLen; + VCLKData=*((UShort *)(ROMAddr+0x208)); + VCLKData=VCLKData+data+(CRT1VCLKLen-2); + VCLK=*((UShort *)(ROMAddr+VCLKData)); + if(ModeNo<=0x13) VCLK=0; + + data=GetReg1(P3c4,0x07); + data=data&0x7B; + if(VCLK>=150) data=data|0x80; /* VCLK > 150 */ + SetReg1(P3c4,0x07,data); + + data=GetReg1(P3c4,0x32); + data=data&0xD7; + if(VCLK>=150) data=data|0x08; /* VCLK > 150 */ + SetReg1(P3c4,0x32,data); + + data2=0x03; + if(VCLK>135) data2=0x02; + if(VCLK>160) data2=0x01; + if(VCLK>260) data2=0x00; + data=GetReg1(P3c4,0x07); + data=data&0xFC; + data=data|data2; + SetReg1(P3c4,0x07,data); +} + +static void LoadDAC(ULong ROMAddr) +{ + UShort data,data2; + UShort time,i,j,k; + UShort m,n,o; + UShort si,di,bx,dl; + UShort al,ah,dh; + UShort *table=0; + + data=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); + data=data&DACInfoFlag; + time=64; + if(data==0x00) table=MDA_DAC; + if(data==0x08) table=CGA_DAC; + if(data==0x10) table=EGA_DAC; + if(data==0x18) { + time=256; + table=VGA_DAC; + } + if(time==256) j=16; + else j=time; + + SetReg3(P3c6,0xFF); + SetReg3(P3c8,0x00); + + for(i=0;i<j;i++) { + data=table[i]; + for(k=0;k<3;k++) { + data2=0; + if(data&0x01) data2=0x2A; + if(data&0x02) data2=data2+0x15; + SetReg3(P3c9,data2); + data=data>>2; + } + } + + if(time==256) { + for(i=16;i<32;i++) { + data=table[i]; + for(k=0;k<3;k++) SetReg3(P3c9,data); + } + si=32; + for(m=0;m<9;m++) { + di=si; + bx=si+0x04; + dl=0; + for(n=0;n<3;n++) { + for(o=0;o<5;o++) { + dh=table[si]; + ah=table[di]; + al=table[bx]; + si++; + WriteDAC(dl,ah,al,dh); + } /* for 5 */ + si=si-2; + for(o=0;o<3;o++) { + dh=table[bx]; + ah=table[di]; + al=table[si]; + si--; + WriteDAC(dl,ah,al,dh); + } /* for 3 */ + dl++; + } /* for 3 */ + si=si+5; + } /* for 9 */ + } +} + +static void WriteDAC(UShort dl, UShort ah, UShort al, UShort dh) +{ + UShort temp; + UShort bh,bl; + + bh=ah; + bl=al; + if(dl!=0) { + temp=bh; + bh=dh; + dh=temp; + if(dl==1) { + temp=bl; + bl=dh; + dh=temp; + } + else { + temp=bl; + bl=bh; + bh=temp; + } + } + SetReg3(P3c9,(UShort)dh); + SetReg3(P3c9,(UShort)bh); + SetReg3(P3c9,(UShort)bl); +} + +static void DisplayOn(void) +{ + UShort data; + + data=GetReg1(P3c4,0x01); + data=data&0xDF; + SetReg1(P3c4,0x01,data); +} + +static void DisplayOff(void) +{ + UShort data; + + data=GetReg1(P3c4,0x01); + data=data|0x20; + SetReg1(P3c4,0x01,data); +} + +void SetReg1(UShort port, UShort index, UShort data) +{ + outb(port ,(UChar)(index & 0xff)); + port++; + outb(port ,(UChar)(data & 0xff)); +} + +static void SetReg3(UShort port, UShort data) +{ + outb(port, (UChar)(data & 0xff)); +} + +static UShort GetReg1(UShort port, UShort index) +{ + UChar data; + + outb(port, (UChar)(index & 0xff)); + port += 1; + data = inb(port); + return(data); +} + +static UShort GetReg2(UShort port) +{ + UChar data; + + data = inb(port); + + return(data); +} + +static UShort GetModeIDLength(ULong ROMAddr, UShort ModeNo) +{ + UChar ModeID; + UShort modeidlength; + UShort usModeIDOffset; + + return(10); + modeidlength=0; + usModeIDOffset=*((UShort *)(ROMAddr+0x20A)); /* Get EModeIDTable */ + ModeID=*((UChar *)(ROMAddr+usModeIDOffset)); /* Offset 0x20A */ + while(ModeID!=0x2E) { + modeidlength++; + usModeIDOffset=usModeIDOffset+1; /* 10 <= ExtStructSize */ + ModeID=*((UChar *)(ROMAddr+usModeIDOffset)); + } + return(modeidlength); +} + +static UShort GetRefindexLength(ULong ROMAddr, UShort ModeNo) +{ + UChar ModeID; + UChar temp; + UShort refindexlength; + UShort usModeIDOffset; + UShort usREFIndex; + UShort usIDLength; + + usModeIDOffset=*((UShort *)(ROMAddr+0x20A)); /* Get EModeIDTable */ + ModeID=*((UChar *)(ROMAddr+usModeIDOffset)); /* Offset 0x20A */ + usIDLength = GetModeIDLength(ROMAddr, ModeNo); + while(ModeID!=0x40) { + usModeIDOffset=usModeIDOffset+usIDLength; /*10 <= ExtStructSize */ + ModeID=*((UChar *)(ROMAddr+usModeIDOffset)); + } + + refindexlength=1; + usREFIndex=*((UShort *)(ROMAddr+usModeIDOffset+0x04)); /* si+Ext_point */ + usREFIndex++; + temp=*((UChar *)(ROMAddr+usREFIndex)); /* di => REFIndex */ + while(temp!=0xFF) { + refindexlength++; + usREFIndex++; + temp=*((UChar *)(ROMAddr+usREFIndex)); /* di => REFIndex */ + } + return(refindexlength); +} + +static void SetInterlace(ULong ROMAddr, UShort ModeNo) +{ + ULong Temp; + UShort data,Temp2; + + Temp = (ULong)GetReg1(P3d4, 0x01); + Temp++; + Temp=Temp*8; + + if(Temp==1024) data=0x0035; + else if(Temp==1280) data=0x0048; + else data=0x0000; + + Temp2=*((UShort *)(ROMAddr+REFIndex+0x00)); + Temp2 &= InterlaceMode; + if(Temp2 == 0) data=0x0000; + + SetReg1(P3d4,0x19,data); + + Temp = (ULong)GetReg1(P3d4, 0x1A); + Temp2= (UShort)(Temp & 0xFC); + SetReg1(P3d4,0x1A,(UShort)Temp); + + Temp = (ULong)GetReg1(P3c4, 0x0f); + Temp2= (UShort)Temp & 0xBF; + if(ModeNo==0x37) Temp2=Temp2|0x40; + SetReg1(P3d4,0x1A,(UShort)Temp2); +} + +static void SetCRT1FIFO(ULong ROMAddr) +{ + UShort index,data,VCLK,data2,MCLKOffset,MCLK,colorth=0; + UShort ah,bl,A,B; + + index=*((UChar *)(ROMAddr+REFIndex+0x03)); + CRT1VCLKLen=GetVCLKLen(ROMAddr); + data=index*CRT1VCLKLen; + VCLKData=*((UShort *)(ROMAddr+0x208)); + VCLKData=VCLKData+data+(CRT1VCLKLen-2); + VCLK=*((UShort *)(ROMAddr+VCLKData)); /* Get VCLK */ + + MCLKOffset=*((UShort *)(ROMAddr+0x20C)); + index=GetReg1(P3c4,0x3A); + index=index&07; + MCLKOffset=MCLKOffset+index*5; + MCLK=*((UChar *)(ROMAddr+MCLKOffset+0x03)); /* Get MCLK */ + + data2=ModeType-0x02; + switch (data2) { + case 0 : colorth=1; break; + case 1 : colorth=2; break; + case 2 : colorth=4; break; + case 3 : colorth=4; break; + case 4 : colorth=6; break; + case 5 : colorth=8; break; + } + + do{ +/*==============*/ + B=(UShort)(CalcDelay(ROMAddr,0)*VCLK*colorth); + B=B/(16*MCLK); + B++; + + A=(CalcDelay(ROMAddr,1)*VCLK*colorth); + A=A/(16*MCLK); + A++; + + if(A<4) A=0; + else A=A-4; + + if(A>B) bl=A; + else bl=B; + + bl++; + if(bl>0x13) { + data=GetReg1(P3c4,0x16); + data=data>>6; + if(data!=0) { + data--; + data=data<<6; + data2=GetReg1(P3c4,0x16); + data2=(data2&0x3f)|data; + SetReg1(P3c4,0x16,data2); + } + else bl=0x13; + } +/*==============*/ + } while(bl>0x13); + + ah=bl; + ah=ah<<4; + ah=ah|0x0f; + SetReg1(P3c4,0x08,ah); + + data=bl; + data=data&0x10; + data=data<<1; + data2=GetReg1(P3c4,0x0F); + data2=data2&0x9f; + data2=data2|data; + SetReg1(P3c4,0x0F,data2); + + data=bl+3; + if(data>0x0f) data=0x0f; + SetReg1(P3c4,0x3b,0x00); + data2=GetReg1(P3c4,0x09); + data2=data2&0xF0; + data2=data2|data; + SetReg1(P3c4,0x09,data2); +} + +static UShort CalcDelay(ULong ROMAddr,UShort key) +{ + UShort data,data2,temp0,temp1; + UChar ThLowA[]= {61,3,52,5,68,7,100,11, + 43,3,42,5,54,7, 78,11, + 34,3,37,5,47,7, 67,11}; + UChar ThLowB[]= {81,4,72,6,88,8,120,12, + 55,4,54,6,66,8, 90,12, + 42,4,45,6,55,8, 75,12}; + UChar ThTiming[]= {1,2,2,3,0,1,1,2}; + + data=GetReg1(P3c4,0x16); + data=data>>6; + data2=GetReg1(P3c4,0x14); + data2=(data2>>4)&0x0C; + data=data|data2; + data=data<1; + if(key==0) { + temp0=(UShort)ThLowA[data]; + temp1=(UShort)ThLowA[data+1]; + } + else { + temp0=(UShort)ThLowB[data]; + temp1=(UShort)ThLowB[data+1]; + } + + data2=0; + data=GetReg1(P3c4,0x18); + if(data&0x02) data2=data2|0x01; + if(data&0x20) data2=data2|0x02; + if(data&0x40) data2=data2|0x04; + + data=temp1*ThTiming[data2]+temp0; + return(data); +} + +static void SetCRT1FIFO2(ULong ROMAddr) +{ + UShort index,data,VCLK,data2,MCLKOffset,MCLK,colorth=0; + UShort ah,bl,B; + ULong eax; + + index=*((UChar *)(ROMAddr+REFIndex+0x03)); + CRT1VCLKLen=GetVCLKLen(ROMAddr); + data=index*CRT1VCLKLen; + VCLKData=*((UShort *)(ROMAddr+0x208)); + VCLKData=VCLKData+data+(CRT1VCLKLen-2); + VCLK=*((UShort *)(ROMAddr+VCLKData)); /* Get VCLK */ + + MCLKOffset=*((UShort *)(ROMAddr+0x20C)); + index=GetReg1(P3c4,0x1A); + index=index&07; + MCLKOffset=MCLKOffset+index*5; + MCLK=*((UShort *)(ROMAddr+MCLKOffset+0x03)); /* Get MCLK */ + + data2=ModeType-0x02; + switch (data2) { + case 0 : colorth=1; break; + case 1 : colorth=1; break; + case 2 : colorth=2; break; + case 3 : colorth=2; break; + case 4 : colorth=3; break; + case 5 : colorth=4; break; + } + + do{ +/*==============*/ + B=(CalcDelay2(ROMAddr,0)*VCLK*colorth); + if (B%(16*MCLK) == 0) + { + B=B/(16*MCLK); + bl=B+1; + } + else + { + B=B/(16*MCLK); + bl=B+2; + } + + if(bl>0x13) { + data=GetReg1(P3c4,0x15); + data=data&0xf0; + if(data!=0xb0) { + data=data+0x20; + if(data==0xa0) data=0x30; + + data2=GetReg1(P3c4,0x15); + data2=(data2&0x0f)|data; + SetReg1(P3c4,0x15,data2); + } + else bl=0x13; + } +/*==============*/ + } while(bl>0x13); + + data2=GetReg1(P3c4,0x15); + data2=(data2&0xf0)>>4; + data2=data2<<24; + +/* ========================*/ + SetReg4(0xcf8,0x80000050); + eax=GetReg3(0xcfc); + eax=eax&0x0f0ffffff; + eax=eax|data2; + SetReg4(0xcfc,eax); +/* ========================*/ + + ah=bl; + ah=ah<<4; + ah=ah|0x0f; + SetReg1(P3c4,0x08,ah); + + data=bl; + data=data&0x10; + data=data<<1; + data2=GetReg1(P3c4,0x0F); + data2=data2&0x9f; + data2=data2|data; + SetReg1(P3c4,0x0F,data2); + + data=bl+3; + if(data>0x0f) data=0x0f; + SetReg1(P3c4,0x3b,0x00); + data2=GetReg1(P3c4,0x09); + data2=data2&0xF0; + data2=data2|data; + SetReg1(P3c4,0x09,data2); +} + +static UShort CalcDelay2(ULong ROMAddr,UShort key) +{ + UShort data,index; + UChar LatencyFactor[]={88,80,78,72,70,00, + 00,79,77,71,69,49, + 88,80,78,72,70,00, + 00,72,70,64,62,44}; + + index=0; + data=GetReg1(P3c4,0x14); + if(data&0x80) index=index+12; + + data=GetReg1(P3c4,0x15); + data=(data&0xf0)>>4; + if(data&0x01) index=index+6; + + data=data>>1; + index=index+data; + data=LatencyFactor[index]; + + return(data); +} + +static void SetReg4(UShort port, ULong data) +{ + outl(port, (ULong)(data & 0xffffffff)); +} + +ULong GetReg3(UShort port) +{ + ULong data; + + data = inl(port); + return(data); +} + +static void SetPitch(ScrnInfoPtr pScrn, UShort BaseAddr) +{ + SISPtr pSiS = SISPTR(pScrn); + ULong HDisplay; + ULong temp; + UShort Port = BaseAddr + IND_SIS_CRT2_PORT_04; + + HDisplay = pSiS->scrnOffset / 8; + SetReg1(P3d4, 0x13, HDisplay); + temp = (GetReg1(P3c4, 0x0E) & 0xF0) | (HDisplay>>8); + SetReg1(P3c4, 0x0E, temp); + + SetReg1(Port, 0x24, 1); + SetReg1(Port, 0x07, HDisplay); + temp = (GetReg1(Port, 0x09) & 0xF0) | (HDisplay>>8); + SetReg1(Port, 0x09, temp); + + +} +static UShort CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + UShort i = (pScrn->bitsPerPixel+7)/8 - 1; + UShort ModeIndex = 0; + switch(mode->HDisplay) + { + case 640: + ModeIndex = ModeIndex_640x480[i]; + break; + case 720: + if(mode->VDisplay == 480) + ModeIndex = ModeIndex_720x480[i]; + else + ModeIndex = ModeIndex_720x576[i]; + break; + case 800: + ModeIndex = ModeIndex_800x600[i]; + break; + case 1024: + ModeIndex = ModeIndex_1024x768[i]; + break; + case 1280: + ModeIndex = ModeIndex_1280x1024[i]; + break; + case 1600: + ModeIndex = ModeIndex_1600x1200[i]; + break; + } + + return(ModeIndex); +} + +static UShort CalcRefreshRate(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + SISPtr pSiS = SISPTR(pScrn); + UShort Index=0; + UShort i=0; + UShort Rate=1; + UShort temp = (int)(mode->VRefresh+0.5); - SetFlag |= PROGRAMMING_CRT2; - - GetRatePtr(pScrn, ModeNo, SELECT_CRT2); - SaveCRT2Info(pSiS->RelIO+CROFFSET, ModeNo); - DisableBridge(BaseAddr); - UnLockCRT2(BaseAddr); - SetCRT2ModeRegs(BaseAddr,ModeNo); - if(VBInfo & DISABLE_CRT2_DISPLAY) { - LockCRT2(BaseAddr); - return; - } - GetCRT2Data(ROMAddr,ModeNo); -#if 0 - if (VBInfo & SET_CRT2_TO_HIVISION_TV) - ModifyDotClock(); -#endif + switch(mode->HDisplay) + { + case 640: + Index = 0; + break; + case 800: + Index = 1; + break; + case 1024: + Index = 2; + Rate = 2; + break; + case 1280: + Index = 3; + Rate = 2; + break; + case 1600: + Index = 4; + break; + case 720: + if(mode->VDisplay == 480) + Index = 5; + else + Index = 6; + break; + + } + while(RefreshRate[Index][i] != 0) + { + if(temp == RefreshRate[Index][i]) + { + Rate=i+1; + break; + } + else + i++; + } + if(pSiS->VBFlags & CRT2_VGA) + Rate |= Rate << 4; + return(Rate); +} - SetGroup1(pScrn,ModeNo); - SetGroup2(BaseAddr,ROMAddr); - SetGroup3(BaseAddr); - SetGroup4(BaseAddr,ROMAddr,ModeNo); - - LockCRT2(BaseAddr); - if (SetFlag & TV_SIMU_MODE) { - temp = *(CARD16 *)(ROMAddr+ModeIDOffset+1); - if (!(temp & AFTER_LOCK_CRT2)) - SetLockRegs(BaseAddr, 0x04); - } - if (!(VBInfo & SET_IN_SLAVE_MODE)) - EnableCRT2(BaseAddr); - EnableBridge(BaseAddr); - if (!GetLockInfo(pSiS->RelIO+CROFFSET, 0x04)) - SetLockRegs(BaseAddr, 0x08); - - return; -} - - - -unsigned short -GetRatePtr(ScrnInfoPtr pScrn, unsigned short ModeNo, CARD8 CRTx) -{ - short index; - unsigned char LCDFRateIndexMax[2] = { 1, 3}; - unsigned short temp; - unsigned short p3d4 = SISPTR(pScrn)->RelIO+CROFFSET; - unsigned char * ROMAddr = SISPTR(pScrn)->BIOS; - - if (ModeNo <= 0x13) /* Mode No <= 13h then return */ - return (STANDARD_MODE | CRT2_SUPPORT); - - inSISIDXREG(p3d4,0x33,index); /* Get 3d4 CRTC33 */ - if (CRTx == SELECT_CRT1) - index &= 0x0F; /* Frame rate index */ - else - index = (index & 0xF0) >> 4; - - if(index != 0) index--; - - if (SetFlag & PROGRAMMING_CRT2) { - if (VBInfo & SET_CRT2_TO_LCD) { - if (index > LCDFRateIndexMax[LCDResInfo]) - index = LCDFRateIndexMax[LCDResInfo]; - } - } - FRateOffset = *(CARD16 *)(ROMAddr+ModeIDOffset+4); - do { - temp=*(CARD16 *)(ROMAddr+FRateOffset); - if (temp==0xFFFF) - break; - if ((temp & MODE_INFO_MASK) < ModeType) - break; - FRateOffset += EMODE2_SIZE; - index--; - if (index < 0) { - if (!(VBInfo & SET_CRT2_TO_RAMDAC) && - (VBInfo & SET_IN_SLAVE_MODE)) { - index = 0; - if (!(temp & INTERLACE_MODE)) - break; - } - } - } while(index>=0); - - FRateOffset -= EMODE2_SIZE; - if (SetFlag & PROGRAMMING_CRT2) - return AdjustCRT2Rate(ROMAddr) | ENHANCED_MODE; - return (ENHANCED_MODE+CRT2_NO_SUPPORT); -} - -unsigned short -AdjustCRT2Rate(CARD8 *ROMAddr) -{ - unsigned short tempax; - unsigned short temp; - - tempax = 0; - if (VBInfo & SET_CRT2_TO_RAMDAC) - tempax |= SUPPORT_RAMDAC2; - if (VBInfo & SET_CRT2_TO_LCD) { - tempax |= SUPPORT_LCD; - temp = *(ROMAddr+ModeIDOffset+9); - if ((LCDResInfo != PANEL_1280x1024) && (temp >= 9)) - tempax = 0; - } - if (VBInfo & (SET_CRT2_TO_AVIDEO|SET_CRT2_TO_SVIDEO|SET_CRT2_TO_SCART)) - tempax |= SUPPORT_TV; - temp = *(CARD16 *)(ROMAddr+ModeIDOffset+1); - if (!(VBInfo & SET_PAL_TV) && (temp & NO_SUPPORT_SIMU_TV) && - (VBInfo & SET_IN_SLAVE_MODE) && !(VBInfo & SET_NO_SIMU_ON_LOCK)) { - return CRT2_NO_SUPPORT; - } - do { - temp = *(CARD16 *)(ROMAddr+FRateOffset); - if (temp & tempax) - return CRT2_SUPPORT; - temp = *(CARD16 *)(ROMAddr+ModeIDOffset+4); - if (FRateOffset == temp) - break; - FRateOffset -= EMODE2_SIZE; - } while (1); - FRateOffset = *(CARD16 *)(ROMAddr+ModeIDOffset+4); - do { - FRateOffset += EMODE2_SIZE; - temp = *(CARD16 *)(ROMAddr+FRateOffset); - if (temp == 0xFFFF) - return CRT2_NO_SUPPORT; - if (temp & tempax) - return CRT2_SUPPORT; - } while (1); -} - -void -SaveCRT2Info(CARD16 p3d4, CARD16 ModeNo) -{ - outSISIDXREG(p3d4, 0x34, ModeNo); - setSISIDXREG(p3d4, 0x31, ~SET_IN_SLAVE_MODE, - (VBInfo & SET_IN_SLAVE_MODE) >> 8); - andSISIDXREG(p3d4, 0x35, 0xF3); -} - -void -DisableBridge(CARD16 BaseAddr) -{ - unsigned short part2_base = BaseAddr+0x10; - - andSISIDXREG(part2_base, 0, 0xDF); - LongWait(BaseAddr+0x5A); - orSISIDXREG(BaseAddr+SROFFSET, 1, 0x20); /* DisplayOff */ - andSISIDXREG(BaseAddr+SROFFSET, 0x32, 0xDF); - andSISIDXREG(BaseAddr+SROFFSET, 0x1E, 0xDF); -} - -void -LongWait(CARD16 p3da) -{ - unsigned short i; - - for (i=0; i<0xFFFF; i++) { - if (!(inSISREG(p3da) & 0x08)) break; - } - for (i=0; i<0xFFFF; i++) { - if (inSISREG(p3da) & 0x09 == 9) break; - } -} - -Bool -WaitVBRetrace(CARD16 BaseAddr) -{ - unsigned short part1_base = BaseAddr+4; - unsigned short i; - unsigned char temp; - - inSISIDXREG(part1_base, 0, temp); - if (!(temp & 0x80)) - return FALSE; - - outSISREG(part1_base, 0x25); - part1_base++; - for (i=0; i<0xFFFF; i++) { - temp = inSISREG(part1_base); - if (temp & 0x01) break; - } - for (i=0; i<0xFFFF; i++) { - temp = inSISREG(part1_base); - if (!(temp & 0x01)) break; - } - return TRUE; -} - -void -VBLongWait(CARD16 p3da) -{ - unsigned int i, j; - - for (i=0; i<3; i++) { - if (i & 1) { /* VBWaitMode 2 */ - for (j=0; j<0x640000; j++) { - if (!(inSISREG(p3da) & 0x08)) break; - } - } else { /* VBWaitMode 1 */ - for (j=0; j<0x640000; j++) { - if ((inSISREG(p3da) & 0x08)) break; - } - } - } -} - -void -UnLockCRT2(CARD16 BaseAddr) -{ - orSISIDXREG(BaseAddr+4, 0x24, 1); -} - -void -LockCRT2(CARD16 BaseAddr) -{ - andSISIDXREG(BaseAddr+4, 0x24, 0xFE); -} - -void -EnableCRT2(CARD16 BaseAddr) -{ - orSISIDXREG(BaseAddr+SROFFSET, 0x1E, 0x20); -} - -void -EnableBridge(CARD16 BaseAddr) -{ - unsigned short part2_base = BaseAddr+0x10; - unsigned char temp, temp1; - - temp1 = 0; - inSISIDXREG(BaseAddr+CROFFSET, 0x31, temp); - if (temp & (SET_IN_SLAVE_MODE >> 8)) { - inSISIDXREG(BaseAddr+CROFFSET, 0x30, temp); - if (!(temp & (SET_CRT2_TO_RAMDAC >> 8))) { - temp1 = 0x20; - } - } - LongWait(BaseAddr+0x5A); - setSISIDXREG(BaseAddr+SROFFSET, 0x32, ~0x20, temp1); - - LongWait(BaseAddr+0x5A); - orSISIDXREG(BaseAddr+SROFFSET, 0x1E, 0x20); - - LongWait(BaseAddr+0x5A); - setSISIDXREG(part2_base, 0, ~0xE0, 0x20); - - LongWait(BaseAddr+0x5A); - andSISIDXREG(BaseAddr+SROFFSET, 1, ~0x20); /* DisplayOn */ - - LongWait(BaseAddr+0x5A); - andSISIDXREG(part2_base, 0, ~0xE0); - LongWait(BaseAddr+0x5A); - setSISIDXREG(part2_base, 0, ~0xE0, 0x20); - -/* - LongWait(BaseAddr+0x5A); - LongWait(BaseAddr+0x5A); - VBLongWait(BaseAddr); -*/ -} - -void -SetCRT2ModeRegs(CARD16 BaseAddr, CARD16 ModeNo) -{ - CARD16 part1_base = BaseAddr+4; - CARD16 part4_base = BaseAddr+0x14; - CARD8 tempah; - - outSISIDXREG(part1_base, 4, 0); - outSISIDXREG(part1_base, 5, 0); - outSISIDXREG(part1_base, 6, 0); - - /* set index 0 register */ - tempah = 0x80; - if (ModeNo > 0x13) - if (ModeType >= MODE_VGA) - tempah = (0x10 >> (ModeType-MODE_VGA)) | 0x80; - if (VBInfo & SET_IN_SLAVE_MODE) - tempah ^= 0xA0; - if (VBInfo & DISABLE_CRT2_DISPLAY) - tempah = 0; - outSISIDXREG(part1_base, 0, tempah); - - /* set index 1 register */ - tempah = 0x01; - if (!(VBInfo & SET_IN_SLAVE_MODE)) - tempah |= 0x02; - if (!(VBInfo & SET_CRT2_TO_RAMDAC)) { - tempah ^= 0x05; - if (!(VBInfo & SET_CRT2_TO_LCD)) - tempah ^= 0x01; - } - tempah <<= 5; - if (VBInfo & DISABLE_CRT2_DISPLAY) - tempah = 0; - outSISIDXREG(part1_base, 1, tempah); - - tempah >>= 5; - if ((ModeType == MODE_VGA) && (!(VBInfo & SET_IN_SLAVE_MODE))) - tempah |= 0x10; - if (LCDResInfo != PANEL_1024x768) - tempah |= 0x80; - if ((VBInfo & SET_CRT2_TO_TV) && (VBInfo & SET_IN_SLAVE_MODE)) - tempah |= 0x20; - setSISIDXREG(part4_base, 0x0D, ~(0xBF), tempah); - - tempah = 0; - if (VBInfo & SET_CRT2_TO_TV) { - if (!(VBInfo & SET_IN_SLAVE_MODE) || - !(SetFlag & TV_SIMU_MODE)) { - SetFlag |= RPLLDIV2XO; - tempah |= 0x40; - } - } - if (LCDResInfo != PANEL_1024x768) - tempah |= 0x80; - outSISIDXREG(part4_base, 0x0C, tempah); -} - -void -GetCRT2Data(CARD8 *ROMAddr, CARD16 ModeNo) -{ - unsigned short tempax, tempbx; - - RVBHRS = 50; - NewFlickerMode = 0; - RY1COE = RY2COE = RY3COE = RY4COE = 0; - - GetResInfo(ROMAddr, ModeNo); - if (VBInfo & SET_CRT2_TO_RAMDAC) { - GetRAMDAC2Data(ROMAddr, ModeNo); - return; - } - GetCRT2Ptr(ROMAddr, ModeNo); - RVBHCMAX = *CRTC2Ptr | GETBITSTR(*(CRTC2Ptr+4), 7:7, 8:8); - RVBHCFACT = *(CRTC2Ptr+1); - VGAHT = *((CARD16 *)(CRTC2Ptr+2)) & 0xFFF; - VGAVT = (*((CARD16 *)(CRTC2Ptr+3)) >> 4) & 0x7FF; - if (VBInfo & SET_CRT2_TO_LCD) { - HT = *((CARD16 *)(CRTC2Ptr+5)) & 0xFFF; - VT = (*((CARD16 *)(CRTC2Ptr+6)) >> 4) & 0x7FF; - tempax = 1024; - tempbx = 560; - if (VGAVDE != 350) - tempbx = 640; - if (VGAVDE != 400) - tempbx = 768; - if (LCDResInfo == PANEL_1280x1024) { - tempax = 1280; - tempbx = 768; - if (VGAVDE != 360) - tempbx = 800; - if (VGAVDE != 375) - tempbx = 864; - if (VGAVDE != 405) - tempbx = 1024; - } - HDE = tempax; - VDE = tempbx; - } else { /* CRT2ToTV */ - HDE = *(CARD16 *)(CRTC2Ptr+5) & 0xFFF; - VDE =(*(CARD16 *)(CRTC2Ptr+6) >> 4) & 0x7FF; - if (*(CARD16 *)(ROMAddr+ModeIDOffset+1) & HALF_DCLK) - RVBHRS = *(CARD16 *)(CRTC2Ptr+10); - else - RVBHRS = *(CARD16 *)(CRTC2Ptr+8) & 0xFFF; - NewFlickerMode = *(CRTC2Ptr+9) & 0x80; - if (VBInfo & SET_CRT2_TO_HIVISION_TV) { - if (VGAVDE > 480) - SetFlag &= (~TV_SIMU_MODE); - if (SetFlag & TV_SIMU_MODE) { - HT = ST_HIVISION_TV_HT; - VT = ST_HIVISION_TV_VT; - } else { - HT = EXT_HIVISION_TV_HT; - VT = EXT_HIVISION_TV_VT; - } - } else { - RY1COE = *(CRTC2Ptr+12); - RY2COE = *(CRTC2Ptr+13); - RY3COE = *(CRTC2Ptr+14); - RY4COE = *(CRTC2Ptr+15); - if (VBInfo & SET_PAL_TV) { - HT = PAL_HT; - VT = PAL_VT; - } else { - HT = NTSC_HT; - VT = NTSC_VT; - } - } - } /* end of LCD/TV */ -} - -void -GetResInfo(CARD8 *ROMAddr, CARD16 ModeNo) -{ - unsigned char tempal; - unsigned short resX, resY; - unsigned short mode_flag; - - if (ModeNo <= 0x13) { - tempal = *(ROMAddr+ModeIDOffset+5); - resX = StResInfo[tempal][0]; - resY = StResInfo[tempal][1]; - } else { - tempal = *(ROMAddr+ModeIDOffset+9); - resX = ModeResInfo[tempal][0]; - resY = ModeResInfo[tempal][1]; - } - if (ModeNo > 0x13) { - mode_flag = *(CARD16 *)(ROMAddr+ModeIDOffset+1); - if (mode_flag & HALF_DCLK) - resX *= 2; - if (mode_flag & DOUBLE_SCAN) - resY *= 2; - } - if (LCDResInfo != PANEL_1024x768) { - if (resY == 400) resY = 405; - if (resY == 350) resY = 360; - if (SetFlag & LCDVESA_TIMING) - if (resY == 360) resY = 375; - } - HDE = VGAHDE = resX; - VDE = VGAVDE = resY; -} - -void -GetRAMDAC2Data(CARD8 *ROMAddr, CARD16 ModeNo) -{ - unsigned short tempax, /* horizontal total */ - tempbx; /* vertical total */ - unsigned char cr0, cr6, cr7, sra, srb; - - RVBHCMAX=1; - RVBHCFACT=1; - if (ModeNo <= 0x13) { - /* unused */ - ErrorF("Current we do not support STD mode for LCD/TV\n"); - } else { - GetCRT1Ptr(ROMAddr); - cr0 = *(ROMAddr+CRTC1Offset); - cr6 = *(ROMAddr+CRTC1Offset+6); - cr7 = *(ROMAddr+CRTC1Offset+7); - sra = *(ROMAddr+CRTC1Offset+13); - srb = *(ROMAddr+CRTC1Offset+14); - tempax = cr0 | GETBITSTR(srb, 1:0, 9:8); - tempbx = cr6 | GETBITSTR(cr7, 0:0, 8:8) | - GETBITSTR(cr7, 5:5, 9:9) | GETBITSTR(sra, 0:0, 10:10); - if (*(CARD16 *)(ROMAddr+ModeIDOffset+1) & CHAR_8DOT) - HT = VGAHT = tempax * 8; - else - HT = VGAHT = tempax * 9; - VT = VGAVT = tempbx + 1; - } -} - -Bool -GetLockInfo(CARD16 p3d4, CARD8 info) -{ - unsigned char temp; - - inSISIDXREG(p3d4, 0x35, temp); - return ((temp & info)!=0); -} - -void -SetLockRegs(CARD16 BaseAddr, CARD8 info) -{ - if (!(VBInfo & SET_IN_SLAVE_MODE)) - return; - if (VBInfo & SET_CRT2_TO_RAMDAC) - return; - orSISIDXREG(BaseAddr+CROFFSET, 0x35, info); - LongWait(BaseAddr+0x5a); - orSISIDXREG(BaseAddr+SROFFSET, 0x32, 0x20); -} - -void -GetCRT1Ptr(CARD8 *ROMAddr) -{ - CRTC1Offset = *((CARD16 *)(ROMAddr+0x204)) + - *(ROMAddr+FRateOffset+2) * 17; -} - -void -GetCRT2Ptr(CARD8 *ROMAddr, CARD16 ModeNo) -{ - unsigned char index; - if (ModeNo <= 0x13) - index = *(ROMAddr+ModeIDOffset+4); - else - index = *(ROMAddr+FRateOffset+4) & 0x1F; - - if (VBInfo & SET_CRT2_TO_LCD) { - if (LCDResInfo == PANEL_1024x768) - if (SetFlag & LCDVESA_TIMING) - CRTC2Ptr = ExtLCD1Data[index]; - else - CRTC2Ptr = StLCD1Data[index]; - else - if (SetFlag & LCDVESA_TIMING) - CRTC2Ptr = ExtLCD2Data[index]; - else - CRTC2Ptr = StLCD2Data[index]; - } else if (VBInfo & SET_CRT2_TO_HIVISION_TV) { - if (SetFlag & TV_SIMU_MODE) - CRTC2Ptr = StHiTVData[index]; - else - CRTC2Ptr = ExtHiTVData[index]; - } else { - if (VBInfo & SET_PAL_TV) { - if (SetFlag & TV_SIMU_MODE) - CRTC2Ptr = StPALData[index]; - else - CRTC2Ptr = ExtPALData[index]; - } else { - if (SetFlag & TV_SIMU_MODE) - CRTC2Ptr = StNTSCData[index]; - else - CRTC2Ptr = ExtNTSCData[index]; - } - } -} - -void -SetGroup1(ScrnInfoPtr pScrn, CARD16 ModeNo) -{ - CARD16 part1_base = SISPTR(pScrn)->RelIO+4; - CARD8 * ROMAddr = SISPTR(pScrn)->BIOS; - CARD8 * CRTC1Ptr = ROMAddr+CRTC1Offset; - CARD16 tempax, tempbx, tempcx, temp; - - ErrorF("Enter SetGroup1()\n"); - SetCRT2Offset(pScrn); - SetCRT2FIFO(pScrn); - SetCRT2Sync(ROMAddr, part1_base); - GetCRT1Ptr(ROMAddr); - - outSISIDXREG(part1_base, 8, GETVAR8(VGAHT-1)); - setSISIDXREG(part1_base, 9, GENMASK(3:0), GETBITSTR(VGAHT-1,11:8,7:4)); - outSISIDXREG(part1_base, 0x0A, GETVAR8(VGAHDE+12)); - - tempcx = (VGAHT - VGAHDE) >> 2; - tempbx = VGAHDE + 12; - tempbx += tempcx; - tempcx = tempbx + (tempcx << 1); - if (VBInfo & SET_CRT2_TO_RAMDAC) { - tempbx = *(CRTC1Ptr+4) | GETBITSTR(*(CRTC1Ptr+14), 7:6, 9:8); - tempbx = (tempbx-1) << 3; - tempcx = (*(CRTC1Ptr+5) & 0x1F) | ((*(CRTC1Ptr+15) & 4) << 3); - tempcx = (tempcx-1) << 3; - } - outSISIDXREG(part1_base, 0x0B, GETVAR8(tempbx)); - outSISIDXREG(part1_base, 0x0C, GETBITSTR(VGAHDE+12,11:8,7:4) | - GETBITSTR(tempbx,11:8,3:0)); - outSISIDXREG(part1_base, 0x0D, GETVAR8(tempcx)); - outSISIDXREG(part1_base, 0x0E, GETVAR8(VGAVT-1)); - outSISIDXREG(part1_base, 0x0F, GETVAR8(VGAVDE-1)); - outSISIDXREG(part1_base, 0x12, GETBITSTR(VGAVT-1,10:8, 2:0) | - GETBITSTR(VGAVDE-1, 10:8, 5:3)); - tempbx = (VGAVDE + VGAVT) >> 1; - tempcx = ((VGAVT - VGAVDE) >> 4) + tempbx + 1; - if (VBInfo & SET_CRT2_TO_RAMDAC) { - tempbx = *(CRTC1Ptr+8); - if (*(CRTC1Ptr+7) & 4) - tempbx |= 0x100; - if (*(CRTC1Ptr+7) & 0x80) - tempbx |= 0x200; - if (*(CRTC1Ptr+13) & 8) - tempbx |= 0x400; - tempcx = *(CRTC1Ptr+9); - } - outSISIDXREG(part1_base, 0x10, GETVAR8(tempbx)); - outSISIDXREG(part1_base, 0x11, GETBITS(tempcx, 3:0) | - GETBITSTR(tempbx,10:8, 6:4)); - temp = 0x10; - if (LCDResInfo != PANEL_1024x768) - temp = 0x20; - if (VBInfo & SET_CRT2_TO_TV) { - if (VBInfo & SET_CRT2_TO_HIVISION_TV) - temp = 0x20; - else - temp = 8; - } - setSISIDXREG(part1_base, 0x13, ~0x3C, temp); - - if (!(VBInfo & SET_IN_SLAVE_MODE)) - return; - - /* skip set in slave/lock mode */ - - ErrorF("Leave SetGroup1()\n"); -} - -void -SetGroup2(CARD16 BaseAddr, CARD8 *ROMAddr) -{ - CARD16 part2_base = BaseAddr+0x10; - CARD8 temp; - CARD16 tempax, tempcx, tempbx, *Data16Ptr; - - ErrorF("Enter SetGroup2()\n"); - temp = (VBInfo & SET_CRT2_TO_AVIDEO) << 1 | - (VBInfo & SET_CRT2_TO_SVIDEO) >> 1 | - (VBInfo & SET_CRT2_TO_SCART) >> 3 | - (VBInfo & SET_CRT2_TO_HIVISION_TV) >> 7 ; - temp ^= 0x0C; - if (!(VBInfo & (SET_CRT2_TO_HIVISION_TV | SET_PAL_TV))) - temp |= 0x10; - outSISIDXREG(part2_base, 0, temp); - - if (VBInfo & (SET_CRT2_TO_HIVISION_TV | SET_PAL_TV)) - SetBlock(part2_base, 0x31, 0x34, ROMAddr+0xF1); - else - SetBlock(part2_base, 0x31, 0x34, ROMAddr+0xED); - - if (VBInfo & SET_CRT2_TO_HIVISION_TV) { - if (SetFlag & TV_SIMU_MODE) { - SetBlock(part2_base, 0x01, 0x2D, HiTVTimingSimu1); - SetBlock(part2_base, 0x39, 0x45, HiTVTimingSimu2); - Data16Ptr = HiTVTimingSimu3; - } else { - SetBlock(part2_base, 0x01, 0x2D, HiTVTiming1); - SetBlock(part2_base, 0x39, 0x45, HiTVTiming2); - Data16Ptr = HiTVTiming3; - } - } else { - if (VBInfo & SET_PAL_TV) { - SetBlock(part2_base, 0x01, 0x2D, PALTiming1); - SetBlock(part2_base, 0x39, 0x45, PALTiming2); - Data16Ptr = PALTiming3; - } else { - SetBlock(part2_base, 0x01, 0x2D, NTSCTiming1); - SetBlock(part2_base, 0x39, 0x45, NTSCTiming2); - Data16Ptr = NTSCTiming3; - } - } - - orSISIDXREG(part2_base, 0x0A, NewFlickerMode); - outSISIDXREG(part2_base, 0x35, RY1COE); - outSISIDXREG(part2_base, 0x36, RY2COE); - outSISIDXREG(part2_base, 0x37, RY3COE); - outSISIDXREG(part2_base, 0x38, RY4COE); - outSISIDXREG(part2_base, 0x1B, GETVAR8(HT-1)); - setSISIDXREG(part2_base, 0x1D, ~0x0F, GETBITS(HT-1,11:8)); - - if (VBInfo & SET_CRT2_TO_HIVISION_TV) - tempcx = (HT >> 1) + 3; - else - tempcx = (HT >> 1) + 7; - setSISIDXREG(part2_base, 0x22, ~0xF0, GETBITSTR(tempcx, 3:0, 7:4)); - - tempbx = Data16Ptr[0] + tempcx; - outSISIDXREG(part2_base, 0x24, GETVAR8(tempbx)); - setSISIDXREG(part2_base, 0x25, ~0xF0, GETBITSTR(tempbx, 11:8, 7:4)); - - if (VBInfo & SET_CRT2_TO_HIVISION_TV) - tempcx = tempbx += 4; - else - tempbx += 8; - setSISIDXREG(part2_base, 0x29, ~0xF0, GETBITSTR(tempbx, 3:0, 7:4)); - - tempcx += Data16Ptr[1]; - outSISIDXREG(part2_base, 0x27, GETVAR8(tempcx)); - setSISIDXREG(part2_base, 0x28, ~0xF0, GETBITSTR(tempcx, 11:8, 7:4)); - - if (VBInfo & SET_CRT2_TO_HIVISION_TV) - tempcx += 4; - else - tempcx += 8; - setSISIDXREG(part2_base, 0x2A, ~0xF0, GETBITSTR(tempcx, 3:0, 7:4)); - tempcx = (HT >> 1) - Data16Ptr[2]; - setSISIDXREG(part2_base, 0x2D, ~0xF0, GETBITSTR(tempcx, 3:0, 7:4)); - tempcx -= 11; - if (!(VBInfo & SET_CRT2_TO_TV)) - tempcx = GetVGAHT2()-1; - outSISIDXREG(part2_base, 0x2E, GETVAR8(tempcx)); - switch (VGAVDE) { - case 360: - case 375: - tempbx = 746; - break; - case 405: - tempbx = 853; - break; - default: - tempbx = VDE; - } - if (VBInfo & SET_CRT2_TO_TV) - tempbx >>= 1; - tempbx -= 2; - outSISIDXREG(part2_base, 0x2F, GETVAR8(tempbx)); - - temp = GETBITS(tempcx, 11:8) | GETBITSTR(tempbx, 9:8, 7:6); - temp |= 0x10; - if (!(VBInfo & SET_CRT2_TO_SVIDEO)) - temp |= 0x20; - outSISIDXREG(part2_base, 0x30, temp); - - tempbx = 0; - temp = 0; - if ( !(*(CARD16 *)(ROMAddr+ModeIDOffset+1) & HALF_DCLK) ) { - tempcx = VGAHDE; - if (tempcx >= HDE) { - temp |= 0x20; - } - } - tempcx = 0x0101; - if (VBInfo & SET_CRT2_TO_HIVISION_TV) { - if (VGAHDE >= 1024) { - tempcx = 0x1920; - if (VGAHDE >= 1280) { - tempcx = 0x1420; - temp &= (~0x20); - } - } - } - if (!(temp & 0x20)) { - if (*(CARD16 *)(ROMAddr+ModeIDOffset+1) & HALF_DCLK) - tempcx = (tempcx & 0xFF00) | GETVAR8(tempcx << 1); - tempbx = (VGAHDE * (tempcx >> 8) / GETVAR8(tempcx) * - 8*1024 + (HDE-1)) / HDE; - } - outSISIDXREG(part2_base, 0x44, GETVAR8(tempbx)); - setSISIDXREG(part2_base, 0x45, ~0x3F, temp | GETBITS(tempbx, 12:8)); - - if (VBInfo & SET_CRT2_TO_TV) - return; - - outSISIDXREG(part2_base, 0x2C, GETVAR8(HDE-1)); - setSISIDXREG(part2_base, 0x2B, ~0xF0, GETBITSTR(HDE-1, 11:8, 7:4)); - if ((LCDResInfo == PANEL_1280x1024) && - (ModeType == MODE_EGA) && (VGAHDE >= 1024)) { - outSISIDXREG(part2_base, 0x0B, 2); - } else { - outSISIDXREG(part2_base, 0x0B, 1); - } - - outSISIDXREG(part2_base, 0x03, GETVAR8(VDE-1)); - setSISIDXREG(part2_base, 0x0C, ~0x07, GETBITS(VDE-1, 10:8)); - - outSISIDXREG(part2_base, 0x19, GETVAR8(VT-1)); - if (LCDInfo & LCDRGB18BIT) - temp = 0; - else - temp = 0x10; - setSISIDXREG(part2_base, 0x1A, ~0xF0, GETBITSTR(VT-1, 10:8,7:5) | temp); - - tempbx = 768; - if (LCDResInfo != PANEL_1024x768) - tempbx = 1024; - tempax = 1; - if (tempbx != VDE) - tempax = (tempbx-VDE) >> 1; - tempcx = VT - tempax; - tempbx -= tempax; - outSISIDXREG(part2_base, 5, GETVAR8(tempcx)); - outSISIDXREG(part2_base, 6, GETVAR8(tempbx)); - outSISIDXREG(part2_base, 2, GETBITS(tempcx, 2:0) | - GETBITSTR(tempbx, 4:0, 7:3)); - tempbx = VT; - tempax = VDE; - - tempcx = (VT-VDE) >> 4; - tempbx = (tempbx+tempax) >> 1; - outSISIDXREG(part2_base, 4, GETVAR8(tempbx)); - outSISIDXREG(part2_base, 1, GETBITSTR(tempbx, 11:8, 7:4) | - GETBITS(tempbx+tempcx+1, 3:0)); - - andSISIDXREG(part2_base, 0x09, 0xF0); - andSISIDXREG(part2_base, 0x0A, 0xF0); - - tempcx = (HT-HDE) >> 2; - tempbx = HDE+7; - outSISIDXREG(part2_base, 0x23, GETVAR8(tempbx)); - setSISIDXREG(part2_base, 0x25, ~0x0F, GETBITS(tempbx, 11:8)); - - outSISIDXREG(part2_base, 0x1F, 0x07); - andSISIDXREG(part2_base, 0x20, 0x0F); - - tempbx += tempcx; - outSISIDXREG(part2_base, 0x1C, GETVAR8(tempbx)); - setSISIDXREG(part2_base, 0x1D, ~0xF0, GETBITSTR(tempbx, 11:8, 7:4)); - - tempbx += tempcx; - outSISIDXREG(part2_base, 0x21, GETVAR8(tempbx)); - - andSISIDXREG(part2_base, 0x17, 0xFB); - andSISIDXREG(part2_base, 0x18, 0xDF); - - ErrorF("Leave SetGroup2()\n"); -} - -void -SetCRT2Offset(ScrnInfoPtr pScrn) -{ - unsigned short offset; - SISPtr pSiS; - CARD16 part1_base; - - if (VBInfo & SET_IN_SLAVE_MODE) - return; - - pSiS = SISPTR(pScrn); - part1_base = pSiS->RelIO+4; - offset = pSiS->scrnOffset >> 3; - - outSISIDXREG(part1_base, 7, GETVAR8(offset)); - setSISIDXREG(part1_base, 9, - ~GENMASK(3:0), GETBITSTR(offset, 11:8, 3:0)); - - offset = (offset >> 3)+1; /* SetFIFOStop */ - outSISIDXREG(part1_base, 3, GETVAR8(offset)); -} - -static char timing[8] = {1, 2, 2, 3, 0, 1, 1, 2}; -static short factor[12][2] = {{81, 4}, {72, 6}, {88, 8}, {120, 12}, - {55, 4}, {54, 6}, {66, 8}, { 90, 12}, - {42, 4}, {45, 6}, {55, 8}, { 75, 12}}; -void -SetCRT2FIFO(ScrnInfoPtr pScrn) -{ - unsigned int Low; - unsigned int High; - SISPtr pSiS = SISPTR(pScrn); +static void WaitVertical(void) +{ #if 0 - unsigned int temp, dclk, vclk; + UShort tempax,tempdx; + + tempdx=0x3da; + do { + tempax=GetReg2(tempdx); + } while(!(tempax&01)); + + do { + tempax=GetReg2(tempdx); + } while(!(tempax&01)); #endif - unsigned short part1_base = pSiS->RelIO+4; - - Low = 0x14; - High = 0x17; - if (pSiS->Chipset == PCI_CHIP_SIS300) { - if (Low > 0x0F) - High = 0x16; - else - High = 0x13; - } - setSISIDXREG(part1_base, 2, ~0x1F, Low); - setSISIDXREG(part1_base, 1, ~0x1F, High); -} - -void -SetCRT2Sync(CARD8 * ROMAddr, CARD16 part1_base) -{ - setSISIDXREG(part1_base, 0x19, ~0xC0, - (*(CARD16 *)(ROMAddr+FRateOffset) >> 8) & 0xC0); -} - -void -SetBlock(CARD16 port, CARD8 from, CARD8 to, CARD8 *DataPtr) -{ - CARD8 index; - - for (index=from; index <= to; index++, DataPtr++) { - outSISIDXREG(port, index, *DataPtr); - } -} -unsigned short -GetVGAHT2() -{ - return ((VT-VDE)*RVBHCFACT*HT) / ((VGAVT-VGAVDE)*RVBHCMAX); -} - -void -SetGroup3(CARD16 BaseAddr) -{ - ErrorF("Enter SetGroup3()\n"); - if (VBInfo & SET_CRT2_TO_HIVISION_TV) - if (SetFlag & TV_SIMU_MODE) - SetBlock(BaseAddr+0x12, 0, 0x3E, HiTVGroup3Simu); - else - SetBlock(BaseAddr+0x12, 0, 0x3E, HiTVGroup3Data); - else - if (VBInfo & SET_PAL_TV) - SetBlock(BaseAddr+0x12, 0, 0x3E, PALGroup3Data); - else - SetBlock(BaseAddr+0x12, 0, 0x3E, NTSCGroup3Data); - ErrorF("Leave SetGroup3()\n"); -} - -void -SetGroup4(CARD16 BaseAddr, CARD8 *ROMAddr, CARD16 ModeNo) -{ - CARD16 part4_base = BaseAddr+0x14; - CARD8 temp; - CARD16 tempax, tempbx, tempcx; - CARD32 temp32; - - ErrorF("Enter SetGroup4()\n"); - outSISIDXREG(part4_base, 0x13, RVBHCFACT); - outSISIDXREG(part4_base, 0x14, GETVAR8(RVBHCMAX)); - outSISIDXREG(part4_base, 0x16, GETVAR8(VGAHT-1)); - tempcx = VGAVT-1; - if (!(VBInfo & SET_CRT2_TO_TV)) - tempcx -= 5; - outSISIDXREG(part4_base, 0x17, GETVAR8(tempcx)); - outSISIDXREG(part4_base, 0x15, GETBITSTR(RVBHCMAX, 7:7, 8:8) | - GETBITSTR(VGAHT-1, 11:8, 6:3) | - GETBITS(tempcx, 10:8)); - - tempbx = VGAHDE; - if (*(CARD16 *)(ROMAddr+ModeIDOffset+1) & HALF_DCLK) - tempbx >>= 1; - switch (VBInfo & (SET_CRT2_TO_TV | SET_CRT2_TO_LCD)) { - case SET_CRT2_TO_HIVISION_TV: - if (tempbx == 1024) - temp = 0xA0; - if (tempbx == 1280) - temp = 0xC0; - else - temp = 0; - break; - case SET_CRT2_TO_LCD: - if (tempbx <= 800) - temp = 0; - else - temp = 0x60; - break; - default: - temp = 0x80; - } - if (LCDResInfo != PANEL_1280x1024) - temp |= 0x0A; - setSISIDXREG(part4_base, 0x0E, ~0xEF, temp); - - if ((VBInfo & SET_CRT2_TO_HIVISION_TV) && !(temp & 0xE0)) - tempbx = VDE >> 1; - else - tempbx = VDE; - outSISIDXREG(part4_base, 0x18, GETVAR8(RVBHRS)); - if (VGAVDE >= tempbx) { - tempax = VGAVDE - tempbx; - temp = 0x40; - } else { - tempax = VGAVDE; - temp = 0; - } - temp32 = (tempax * 256*1024 + (tempbx-1)) / tempbx; - outSISIDXREG(part4_base, 0x1B, GETVAR8(temp32)); - outSISIDXREG(part4_base, 0x1A, GETBITS(temp32, 15:8)); - outSISIDXREG(part4_base, 0x19, GETBITS(RVBHRS, 11:8) | - GETBITSTR(temp32, 17:16, 5:4) | temp); - SetCRT2VCLK(BaseAddr, ROMAddr, ModeNo); - ErrorF("Leave SetGroup4()\n"); -} - -void -SetCRT2VCLK(CARD16 BaseAddr, CARD8 *ROMAddr, CARD16 ModeNo) -{ - CARD8 *VCLK2Ptr; - CARD16 part4_base = BaseAddr + 0x14; - - VCLK2Ptr = GetVCLK2Ptr(BaseAddr, ROMAddr, ModeNo); - outSISIDXREG(part4_base, 0x0A, 1); - outSISIDXREG(part4_base, 0x0B, *(VCLK2Ptr+1)); - outSISIDXREG(part4_base, 0x0A, *(VCLK2Ptr)); - outSISIDXREG(part4_base, 0x12, 0); - if (VBInfo & SET_CRT2_TO_RAMDAC) { - orSISIDXREG(part4_base, 0x12, 0x28); - } else { - orSISIDXREG(part4_base, 0x12, 0x08); - } -} - -CARD8 * -GetVCLK2Ptr(CARD16 BaseAddr, CARD8 *ROMAddr, CARD16 ModeNo) -{ - CARD8 index; - CARD16 VCLKTableBase; - - if (ModeNo <= 0x13) - index = *(ROMAddr+ModeIDOffset+4); - else - index = *(ROMAddr+FRateOffset+4); - - switch (VBInfo & 0xFC) { - case SET_CRT2_TO_HIVISION_TV: - if (SetFlag & RPLLDIV2XO) - index = HITVVCLKDIV2; - else - index = HITVVCLK; - if (SetFlag & TV_SIMU_MODE) - index = HITVSIMUVCLK; - break; - case SET_CRT2_TO_LCD: - if (LCDResInfo == PANEL_1024x768) - index = VCLK65; - else - index = VCLK108_2; - break; - case SET_CRT2_TO_RAMDAC: - if (ModeNo <= 0x13) { - index = GETBITS(inSISREG(BaseAddr+0x4C), 3:2); - } else { - index = *(ROMAddr+FRateOffset+3); - } - break; - default: - if (SetFlag & RPLLDIV2XO) - index = TVVCLKDIV2; - else - index = TVVCLK; - } - VCLKTableBase = *(CARD16 *)(ROMAddr+0x208); - return (ROMAddr + VCLKTableBase + index*4); +} + +static Bool SetCRT2Group(UShort BaseAddr,ULong ROMAddr,UShort ModeNo, ScrnInfoPtr pScrn) +{ + UShort temp; + + SetFlag=SetFlag|ProgrammingCRT2; + SearchModeID(ROMAddr,ModeNo); + temp=GetRatePtrCRT2(ROMAddr,ModeNo); + if(((temp&0x02)==0) && ((VBInfo&CRT2DisplayFlag)==0)) + return(FALSE); + SaveCRT2Info(ModeNo); + DisableBridge(BaseAddr); + UnLockCRT2(BaseAddr); + SetDefCRT2ExtRegs(BaseAddr); + SetCRT2ModeRegs(BaseAddr,ModeNo); + if(IF_DEF_LVDS==0) { + if(VBInfo&CRT2DisplayFlag){ + LockCRT2(BaseAddr); + return 0; + } + } + GetCRT2Data(ROMAddr,ModeNo); + if(IF_DEF_LVDS==1) { + GetLVDSDesData(ROMAddr,ModeNo); + } + SetGroup1(BaseAddr,ROMAddr,ModeNo,pScrn); + if(IF_DEF_LVDS==0) { + SetGroup2(BaseAddr,ROMAddr,ModeNo); + SetGroup3(BaseAddr,ROMAddr); + SetGroup4(BaseAddr,ROMAddr,ModeNo); + SetGroup5(BaseAddr,ROMAddr); + } + else { + if(IF_DEF_CH7005==1) SetCHTVReg(ROMAddr,ModeNo); + ModCRT1CRTC(ROMAddr,ModeNo); + SetCRT2ECLK(ROMAddr,ModeNo); + } + EnableCRT2(); + EnableBridge(BaseAddr); + if(IF_DEF_LVDS==0) { + /* SetLockRegs(); */ + } + LockCRT2(BaseAddr); + return 1; +} + +static void SetDefCRT2ExtRegs(UShort BaseAddr) +{ + UShort Part1Port,Part2Port,Part4Port; + UShort temp; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; + Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; + if(IF_DEF_LVDS==0) { + SetReg1(Part1Port,0x02,0x40); + SetReg1(Part4Port,0x10,0x80); + temp=(UChar)GetReg1(P3c4,0x16); + temp=temp&0xC3; + SetReg1(P3d4,0x35,temp); + } + else { + SetReg1(P3d4,0x32,0x02); + SetReg1(Part1Port,0x02,0x00); + } +} + +static UShort GetRatePtrCRT2(ULong ROMAddr, UShort ModeNo) +{ /* return bit0=>0:standard mode 1:extended mode */ + short index; /* bit1=>0:crt2 no support this mode */ + UShort temp; /* 1:crt2 support this mode */ + UShort ulRefIndexLength; + UShort temp1,modeflag1,Flag; + short LCDRefreshIndex[2]={0x03,0x01}; + + if(IF_DEF_CH7005==1) { + if(VBInfo&SetCRT2ToTV) { + modeflag1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(modeflag1&HalfDCLK) return(0); + } + } + if(ModeNo<0x14) return(0); /* Mode No <= 13h then return */ + + index=GetReg1(P3d4,0x33); /* Get 3d4 CRTC33 */ + index=index>>SelectCRT2Rate; /* For CRT2,cl=SelectCRT2Rate=4, shr ah,cl */ + index=index&0x0F; /* Frame rate index */ + if(index!=0) index--; + + if(SetFlag&ProgrammingCRT2){ + Flag=1; + if(IF_DEF_CH7005==1) { + if(VBInfo&SetCRT2ToTV) { + index=0; + Flag=0; + } + } + if((Flag)&&(VBInfo&SetCRT2ToLCD)){ + if(IF_DEF_LVDS==0) { + temp=LCDResInfo; + temp1=LCDRefreshIndex[temp]; + if(index>temp1){ + index=temp1; + } + } + else { + index=0; + } + } + } + + REFIndex=*((UShort *)(ROMAddr+ModeIDOffset+0x04)); /* si+Ext_point */ + + ulRefIndexLength =Ext2StructSize; + do { + temp=*((UShort *)(ROMAddr+REFIndex)); /* di => REFIndex */ + if(temp==0xFFFF) break; + temp=temp&ModeInfoFlag; + if(temp<ModeType) break; + + REFIndex=REFIndex+ulRefIndexLength; /* rate size */ + index--; + if(index<0){ + if(!(VBInfo&SetCRT2ToRAMDAC)){ + if(VBInfo&SetInSlaveMode){ + temp1=*((UShort *)(ROMAddr+REFIndex+0-Ext2StructSize)); + if(temp1&InterlaceMode){ + index=0; + } + } + } + } + } while(index>=0); + REFIndex=REFIndex-ulRefIndexLength; /* rate size */ + + if((SetFlag&ProgrammingCRT2)){ + temp1=AjustCRT2Rate(ROMAddr); + }else{ + temp1=0; + } + + return(0x01|(temp1<<1)); +} + +static Bool AjustCRT2Rate(ULong ROMAddr) +{ + UShort tempax,tempbx=0,temp,resinfo; + UShort tempextinfoflag,Flag; + tempax=0; + if(IF_DEF_LVDS==0) { + if(VBInfo&SetCRT2ToRAMDAC){ + tempax=tempax|SupportRAMDAC2; + } + if(VBInfo&SetCRT2ToLCD){ + tempax=tempax|SupportLCD; + if(LCDResInfo!=Panel1280x1024){ + temp=*((UChar *)(ROMAddr+ModeIDOffset+0x09)); /* si+Ext_ResInfo */ + if(temp>=9) tempax=0; + } + } +/* ynlai begin */ + if(IF_DEF_HiVision==1) { + tempax=tempax|SupportHiVisionTV; + if(VBInfo&SetInSlaveMode){ + resinfo=*((UChar *)(ROMAddr+ModeIDOffset+0x09)); /*si+Ext_ResInfo */ + if(resinfo==4) return(0); + if(resinfo==3) { + if(SetFlag&TVSimuMode) return(0); + } + if(resinfo>7) return(0); + } + } + else { + if(VBInfo&(SetCRT2ToAVIDEO|SetCRT2ToSVIDEO|SetCRT2ToSCART)){ + tempax=tempax|SupportTV; + if(!(VBInfo&SetPALTV)){ + tempextinfoflag=*((UShort *)(ROMAddr+REFIndex+0x0)); /* di+Ext_InfoFlag */ + if(tempextinfoflag&NoSupportSimuTV){ + if(VBInfo&SetInSlaveMode){ + if(!(VBInfo&SetNotSimuMode)){ + return 0; + } + } + } + } + } + } +/* ynlai end */ + tempbx=*((UShort *)(ROMAddr+ModeIDOffset+0x04)); /* si+Ext_point */ + } + else { /* for LVDS */ + Flag=1; + if(IF_DEF_CH7005==1) { + if(VBInfo&SetCRT2ToTV) { + tempax=tempax|SupportCHTV; + Flag=0; + } + } + tempbx=*((UShort *)(ROMAddr+ModeIDOffset+0x04)); + if((Flag)&&(VBInfo&SetCRT2ToLCD)){ + tempax=tempax|SupportLCD; + temp=*((UChar *)(ROMAddr+ModeIDOffset+0x09)); /*si+Ext_ResInfo */ + if(temp>0x08) return(0); /*1024x768 */ + if(LCDResInfo<Panel1024x768){ + if(temp>0x07) return(0); /*800x600 */ + if(temp==0x04) return(0); /*512x384 */ + } + } + } + for(;REFIndex>tempbx;REFIndex-=Ext2StructSize){ + tempextinfoflag=*((UShort *)(ROMAddr+REFIndex+0x0)); /* di+Ext_InfoFlag */ + if(tempextinfoflag&tempax){ + return 1; + } + } + for(REFIndex=tempbx;;REFIndex+=Ext2StructSize){ + tempextinfoflag=*((UShort *)(ROMAddr+REFIndex+0x0)); /* di+Ext_InfoFlag */ + if(tempextinfoflag==0x0FFFF){ + return 0; + } + if(tempextinfoflag&tempax){ + return 1; + } + } + return(FALSE); +} + +static void SaveCRT2Info(UShort ModeNo) +{ + UShort temp1,temp2,temp3; + temp1=(VBInfo&SetInSlaveMode)>>8; + temp2=~(SetInSlaveMode>>8); + temp3=(UChar)GetReg1(P3d4,0x31); + temp3=((temp3&temp2)|temp1); + SetReg1(P3d4,0x31,(UShort)temp3); + temp3=(UChar)GetReg1(P3d4,0x35); + temp3=temp3&0xF3; + SetReg1(P3d4,0x35,(UShort)temp3); +} + +static void DisableLockRegs(void) +{ + UChar temp3; + temp3=(UChar)GetReg1(P3c4,0x32); + temp3=temp3&0xDF; + SetReg1(P3c4,0x32,(UShort)temp3); +} + +static void DisableCRT2(void) +{ + UChar temp3; + temp3=(UChar)GetReg1(P3c4,0x1E); + temp3=temp3&0xDF; + SetReg1(P3c4,0x1E,(UShort)temp3); +} + +void DisableBridge(UShort BaseAddr) +{ + UChar temp3,part2_02,part2_05; + UShort Part2Port,Part1Port=0; + Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; + + if(IF_DEF_LVDS==0) { + part2_02=(UChar)GetReg1(Part2Port,0x02); + part2_05=(UChar)GetReg1(Part2Port,0x05); +/* if(!WaitVBRetrace(BaseAddr)) */ /* return 0:no enable read dram */ + { + LongWait(); + DisableLockRegs(); + } + SetReg1(Part2Port,0x02,0x38); + SetReg1(Part2Port,0x05,0xFF); + temp3=(UChar)GetReg1(Part2Port,0x00); + temp3=temp3&0xDF; + SetReg1(Part2Port,0x00,(UShort)temp3); + SetReg1(Part2Port,0x02,part2_02); + SetReg1(Part2Port,0x05,part2_05); + DisableCRT2(); + } + else { + DisableLockRegs(); + DisableCRT2(); + UnLockCRT2(BaseAddr); + SetRegANDOR(Part1Port,0x02,0xFF,0x40); /*et Part1Port ,index 2, D6=1, */ + } +} + +static void GetCRT2Data(ULong ROMAddr,UShort ModeNo) +{ + if(IF_DEF_LVDS==0){ /*301 */ + GetCRT2Data301(ROMAddr,ModeNo); + return; + }else{ /*LVDS */ + GetCRT2DataLVDS(ROMAddr,ModeNo); + return; + } +} + +static void GetCRT2DataLVDS(ULong ROMAddr,UShort ModeNo) +{ + UShort tempax,tempbx,OldREFIndex; + + OldREFIndex=(UShort)REFIndex; /*push di */ + GetResInfo(ROMAddr,ModeNo); + GetCRT2Ptr(ROMAddr,ModeNo); + + tempax=*((UShort *)(ROMAddr+REFIndex)); + tempax=tempax&0x0FFF; + VGAHT=tempax; + + tempax=*((UShort *)(ROMAddr+REFIndex+1)); + tempax=tempax>>4; + tempax=tempax&0x07FF; + VGAVT=tempax; +/* VGAVT=518; */ + + tempax=*((UShort *)(ROMAddr+REFIndex+3)); + tempax=tempax&0x0FFF; + tempbx=*((UShort *)(ROMAddr+REFIndex+4)); + tempbx=tempbx>>4; + tempbx=tempbx&0x07FF; + + HT=tempax; + VT=tempbx; + + if(IF_DEF_TRUMPION==0){ + if(VBInfo&SetCRT2ToLCD){ + if(!(LCDInfo&LCDNonExpanding)){ + if(LCDResInfo==Panel800x600){ + tempax=800; + tempbx=600; + }else if(LCDResInfo==Panel1024x768){ + tempax=1024; + tempbx=768; + }else{ + tempax=1280; + tempbx=1024; + } + HDE=tempax; + VDE=tempbx; + } + } + } + REFIndex=OldREFIndex; /*pop di */ + return; +} + +static void GetCRT2Data301(ULong ROMAddr,UShort ModeNo) +{ + UShort tempax,tempbx,modeflag1,OldREFIndex; + UShort tempal,tempah,tempbl,resinfo; + + OldREFIndex=REFIndex; /* push di */ + RVBHRS=50;NewFlickerMode=0;RY1COE=0; + RY2COE=0;RY3COE=0;RY4COE=0; + + GetResInfo(ROMAddr,ModeNo); + if(VBInfo&SetCRT2ToRAMDAC){ + GetRAMDAC2DATA(ROMAddr,ModeNo); + REFIndex=OldREFIndex; /* pop di */ + return; + } + GetCRT2Ptr(ROMAddr,ModeNo); + + tempal=*((UChar *)(ROMAddr+REFIndex)); + tempah=*((UChar *)(ROMAddr+REFIndex+4)); + tempax=tempal|(((tempah<<8)>>7)&0xFF00); + RVBHCMAX=tempax; + + tempal=*((UChar *)(ROMAddr+REFIndex+1)); + RVBHCFACT=tempal; + + tempax=*((UShort *)(ROMAddr+REFIndex+2)); + VGAHT=(tempax&0x0FFF); + + tempax=*((UShort *)(ROMAddr+REFIndex+3)); + VGAVT=((tempax>>4)&0x07FF); + + tempax=*((UShort *)(ROMAddr+REFIndex+5)); + tempax=(tempax&0x0FFF); + tempbx=*((UShort *)(ROMAddr+REFIndex+6)); + tempbx=((tempbx>>4)&0x07FF); + tempbl=tempbx&0x00FF; + + if(VBInfo&SetCRT2ToTV){ + tempax=*((UShort *)(ROMAddr+REFIndex+5)); + tempax=(tempax&0x0FFF); + HDE=tempax; + tempax=*((UShort *)(ROMAddr+REFIndex+6)); + tempax=((tempax>>4)&0x07FF); + VDE=tempax; + tempax=*((UShort *)(ROMAddr+REFIndex+8)); + tempbl=(tempax>>8); + tempax=tempax&0x0FFF; + modeflag1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(modeflag1&HalfDCLK){ + tempax=*((UShort *)(ROMAddr+REFIndex+10)); + } + RVBHRS=tempax; +/* ynlai begin */ + tempbl=tempbl&0x80; + if(IF_DEF_HiVision==1) { + resinfo=*((UChar *)(ROMAddr+ModeIDOffset+0x09)); /* si+Ext_ResInfo */ + if(resinfo==8) tempbl=0x40; + else if(resinfo==9) tempbl=0x40; + else if(resinfo==10) tempbl=0x40; + } +/* ynlai end */ + NewFlickerMode=tempbl; + +/* ynlai begin */ + if(IF_DEF_HiVision==1) { + if(VGAVDE==350) SetFlag=SetFlag|TVSimuMode; + tempax=ExtHiTVHT; + tempbx=ExtHiTVVT; + if(VBInfo&SetInSlaveMode) { + if(SetFlag&TVSimuMode) { + tempax=StHiTVHT; + tempbx=StHiTVVT; + modeflag1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(!(modeflag1&Charx8Dot)){ + tempax=StHiTextTVHT; + tempbx=StHiTextTVVT; + } + } + } + } + else { + tempax=*((UShort *)(ROMAddr+REFIndex+12)); + RY1COE=(tempax&0x00FF); + RY2COE=((tempax&0xFF00)>>8); + tempax=*((UShort *)(ROMAddr+REFIndex+14)); + RY3COE=(tempax&0x00FF); + RY4COE=((tempax&0xFF00)>>8); + if(!(VBInfo&SetPALTV)){ + tempax=NTSCHT; + tempbx=NTSCVT; + }else{ + tempax=PALHT; + tempbx=PALVT; + } + } +/* ynlai end */ + } + HT=tempax; + VT=tempbx; + if(!(VBInfo&SetCRT2ToLCD)){ + REFIndex=OldREFIndex; /* pop di */ + return; + } + + tempax=1024; + if(VGAVDE==350){ /* cx->VGAVDE */ + tempbx=560; + }else if(VGAVDE==400){ + tempbx=640; + }else{ + tempbx=768; + } + + if(LCDResInfo==Panel1280x1024){ + tempax=1280; + if(VGAVDE==360){ + tempbx=768; + }else if(VGAVDE==375){ + tempbx=800; + }else if(VGAVDE==405){ + tempbx=864; + }else{ + tempbx=1024; + } + } + + HDE=tempax; + VDE=tempbx; + REFIndex=OldREFIndex; /* pop di */ + return; +} + +static void GetResInfo(ULong ROMAddr,UShort ModeNo) +{ + UShort temp,xres,yres,modeflag1; + if(ModeNo<=0x13){ + temp=(UShort)*((UChar *)(ROMAddr+ModeIDOffset+0x05)); /* si+St_ResInfo */ + xres=StResInfo[temp][0]; + yres=StResInfo[temp][1]; + }else{ + temp=(UShort)*((UChar *)(ROMAddr+ModeIDOffset+0x09)); /* si+Ext_ResInfo */ + xres=ModeResInfo[temp][0]; /* xres->ax */ + yres=ModeResInfo[temp][1]; /* yres->bx */ + modeflag1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(modeflag1&HalfDCLK){ xres=xres*2;} + if(modeflag1&DoubleScanMode){yres=yres*2;} + } + if(!(LCDResInfo==Panel1024x768)){ + if(yres==400) yres=405; + if(yres==350) yres=360; + if(SetFlag&LCDVESATiming){ + if(yres==360) yres=375; + } + } + if(IF_DEF_LVDS==1) { + if(xres==720) xres=640; + } + VGAHDE=xres; + HDE=xres; + VGAVDE=yres; + VDE=yres; +} + +static void GetLVDSDesData(ULong ROMAddr,UShort ModeNo) +{ + UShort old_REFIndex,tempax; + + old_REFIndex=(UShort)REFIndex; /*push di */ + REFIndex=GetLVDSDesPtr(ROMAddr,ModeNo); + + tempax=*((UShort *)(ROMAddr+REFIndex)); + tempax=tempax&0x0FFF; + LCDHDES=tempax; + + if(LCDInfo&LCDNonExpanding){ /*hw walk-a-round */ + if(LCDResInfo>=Panel1024x768){ + if(ModeNo<=0x13){ + LCDHDES=320; + } + } + } + + tempax=*((UShort *)(ROMAddr+REFIndex+1)); + tempax=tempax>>4; + tempax=tempax&0x07FF; + LCDVDES=tempax; + + REFIndex=old_REFIndex; /*pop di */ + return; +} + + +static void GetRAMDAC2DATA(ULong ROMAddr,UShort ModeNo) +{ + UShort tempax,tempbx,tempbh,modeflag1,t1=0,t2; + RVBHCMAX=1;RVBHCFACT=1; + if(ModeNo<=0x13){ + tempax=*((UChar *)(ROMAddr+REFIndex+10)); + tempbx=*((UShort *)(ROMAddr+REFIndex+16)); + }else{ + t1=*((UChar *)(ROMAddr+REFIndex+0x2)); /* Ext_CRT1CRTC=2 */ + t1=t1*CRT1Len; + REFIndex=*((UShort *)(ROMAddr+0x204)); /* Get CRT1Table */ + REFIndex=REFIndex+t1; + t1=*((UChar *)(ROMAddr+REFIndex+0)); + t2=*((UChar *)(ROMAddr+REFIndex+14)); + tempax=(t1&0xFF)|((t2&0x03)<<8); + tempbx=*((UShort *)(ROMAddr+REFIndex+6)); + t1=*((UChar *)(ROMAddr+REFIndex+13)); + t1=(t1&0x01)<<2; + } + + tempbh=tempbx>>8; + tempbh=((tempbh&0x20)>>4)|(tempbh&0x01); + tempbh=tempbh|t1; + tempbx=(tempbx&0xFF)|(tempbh<<8); + tempax=tempax+5; + modeflag1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(modeflag1&Charx8Dot){ + tempax=tempax*8; + }else{ + tempax=tempax*9; + } + + VGAHT=tempax; + HT=tempax; + tempbx++; + VGAVT=tempbx; + VT=tempbx; + +} + +static void GetCRT2Ptr(ULong ROMAddr,UShort ModeNo) +{ + UShort tempcl,tempbx,tempal,tempax,CRT2PtrData=0; + UShort Flag; + + if(IF_DEF_LVDS==0) { + if(VBInfo&SetCRT2ToLCD){ /* LCD */ + tempbx=LCDResInfo; + tempcl=LCDDataLen; + tempbx=tempbx-Panel1024x768; + if(!(SetFlag&LCDVESATiming)) tempbx+=5; + } +/* ynlai begin */ + else { + if(IF_DEF_HiVision==1) { + if(VGAVDE>480) SetFlag=SetFlag&(!TVSimuMode); + tempcl=HiTVDataLen; + tempbx=2; + if(VBInfo&SetInSlaveMode) { + if(!(SetFlag&TVSimuMode)) tempbx=10; + } + } + else { + if(VBInfo&SetPALTV){ + tempcl=TVDataLen; + tempbx=3; + } + else{ + tempbx=4; + tempcl=TVDataLen; + } + } + } +/* ynlai end */ + if(SetFlag&TVSimuMode){ + tempbx=tempbx+4; + } + if(ModeNo<=0x13){ + tempal=*((UChar *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ + }else{ + tempal=*((UChar *)(ROMAddr+REFIndex+4)); /* di+Ext_CRT2CRTC */ + } + tempal=tempal&0x1F; + + tempax=tempal*tempcl; + REFIndex=*((UShort *)(ROMAddr + 0x20E + tempbx*2)); + REFIndex+=tempax; + } + else { /* LVDS */ + Flag=1; + tempbx=0; + if(IF_DEF_CH7005==1) { + if(!(VBInfo&SetCRT2ToLCD)) { + Flag=0; + tempbx=7; + if(VBInfo&SetPALTV) tempbx=tempbx+2; + if(VBInfo&SetCHTVOverScan) tempbx=tempbx+1; + } + } + tempcl=LVDSDataLen; + if(Flag==1) { + tempbx=LCDResInfo-Panel800x600; + if(LCDInfo&LCDNonExpanding){ + tempbx=tempbx+3; + } + } + if(ModeNo<=0x13) tempal=*((UChar *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ + else tempal=*((UChar *)(ROMAddr+REFIndex+0x04)); /* di+Ext_CRT2CRTC */ + tempal=tempal&0x1F; + tempax=tempal*tempcl; + CRT2PtrData=*((UShort *)(ROMAddr+ADR_CRT2PtrData)); /*ADR_CRT2PtrData is defined in init.def */ + REFIndex=*((UShort *)(ROMAddr+CRT2PtrData+tempbx*2)); + REFIndex+=tempax; + } +} + +void UnLockCRT2(UShort BaseAddr) +{ + UChar temp3; + UShort Part1Port; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + temp3=(UChar)GetReg1(Part1Port,0x24); + temp3=temp3|0x01; + SetReg1(Part1Port,0x24,(UShort)temp3); +} + +static void SetCRT2ModeRegs(UShort BaseAddr,UShort ModeNo) +{ + UShort i,j; + UShort tempcl,tempah,temp3; + UShort Part4Port; + UShort Part1Port; + Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + for(i=0,j=4;i<3;i++,j++){ + SetReg1(Part1Port,j,0); + } + + tempcl=ModeType; + if(ModeNo>0x13){ + tempcl=tempcl-ModeVGA; + if((tempcl>0)||(tempcl==0)){ + tempah=((0x010>>tempcl)|0x080); + } + }else{ + tempah=0x080; + } + + if(VBInfo&SetInSlaveMode){ + tempah=(tempah^0x0A0); + } + if(VBInfo&CRT2DisplayFlag){ + tempah=0; + } + SetReg1(Part1Port,0,tempah); + + + if(IF_DEF_LVDS==0) { + tempah=0x01; + if(!(VBInfo&SetInSlaveMode)){ + tempah=(tempah|0x02); + } + if(!(VBInfo&SetCRT2ToRAMDAC)){ + tempah=(tempah^0x05); + if(!(VBInfo&SetCRT2ToLCD)){ + tempah=(tempah^0x01); + } + } + tempah=(tempah<<5)&0xFF; + if(VBInfo&CRT2DisplayFlag){ + tempah=0; + } + SetReg1(Part1Port,0x01,tempah); + + tempah=tempah>>5; + if((ModeType==ModeVGA)&&(!(VBInfo&SetInSlaveMode))){ + tempah=tempah|0x010; + } + if(LCDResInfo!=Panel1024x768){ + tempah=tempah|0x080; + } + if(VBInfo&SetCRT2ToTV){ + if(VBInfo&SetInSlaveMode){ + tempah=tempah|0x020; + } + } + + temp3=(UChar)GetReg1(Part4Port,0x0D); + temp3=temp3&(~0x0BF); + temp3=temp3|tempah; + SetReg1(Part4Port,0x0D,(UShort)temp3); + +/* ynlai begin */ + tempah=0; + if(VBInfo&SetCRT2ToTV) { + if(VBInfo&SetInSlaveMode) { + if(!(SetFlag&TVSimuMode)) { + if(IF_DEF_HiVision==0) { + SetFlag=SetFlag|RPLLDIV2XO; + tempah=tempah|0x40; + } + } + } + else { + SetFlag=SetFlag|RPLLDIV2XO; + tempah=tempah|0x40; + } + } + if(LCDResInfo==Panel1280x1024) tempah=tempah|0x80; + if(LCDResInfo==Panel1280x960) tempah=tempah|0x80; + SetReg1(Part4Port,0x0C,(UShort)temp3); +/* ynlai end */ + } + else { + tempah=0; + if(!(VBInfo&SetInSlaveMode)){ + tempah=tempah|0x02; + } + tempah=(tempah<<5)&0x0FF; + if(VBInfo&CRT2DisplayFlag){ + tempah=0; + } + SetReg1(Part1Port,0x01,tempah); + } +} + +static void SetGroup1(UShort BaseAddr,ULong ROMAddr,UShort ModeNo, + ScrnInfoPtr pScrn) +{ + if(IF_DEF_LVDS==0){ /*301 */ + SetGroup1_301(BaseAddr,ROMAddr,ModeNo,pScrn); + }else{ /*LVDS */ + SetGroup1_LVDS(BaseAddr,ROMAddr,ModeNo,pScrn); + } +} + +static void SetGroup1_LVDS(UShort BaseAddr,ULong ROMAddr,UShort ModeNo, + ScrnInfoPtr pScrn) +{ + UShort temp1,temp2,tempcl,tempch,tempbh,tempal,tempah,tempax,tempbx; + UShort tempcx,OldREFIndex,lcdhdee; + UShort Part1Port; + UShort temppush1,temppush2; + unsigned long int tempeax,tempebx,tempecx,templong; + + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + OldREFIndex=(UShort)REFIndex; /*push di */ + + SetCRT2Offset(Part1Port,ROMAddr); + SetCRT2FIFO(Part1Port,ROMAddr,ModeNo,pScrn); + SetCRT2Sync(BaseAddr,ROMAddr,ModeNo); + + temp1=(VGAHT-1)&0x0FF; /*BTVGA2HT 0x08,0x09 */ + SetReg1(Part1Port,0x08,temp1); + temp1=(((VGAHT-1)&0xFF00)>>8)<<4; + SetRegANDOR(Part1Port,0x09,~0x0F0,temp1); + + + temp1=(VGAHDE+12)&0x0FF; /*BTVGA2HDEE 0x0A,0x0C */ + SetReg1(Part1Port,0x0A,temp1); + /*temp1=((VGAHDE+12)&0xFF00)>>8; Wrong */ + /*SetReg1(Part1Port,0x0C,temp1); */ + + temp1=VGAHDE+12; /*bx BTVGA@HRS 0x0B,0x0C */ + temp2=(VGAHT-VGAHDE)>>2; /* */ + temp1=temp1+temp2; + temp2=(temp2<<1)+temp1; + tempcl=temp2&0x0FF; + + SetReg1(Part1Port,0x0B,(UShort)(temp1&0x0FF)); + tempah=(temp1&0xFF00)>>8; + tempbh=((((VGAHDE+12)&0xFF00)>>8)<<4)&0x0FF; + tempah=tempah|tempbh; + SetReg1(Part1Port,0x0C,tempah); + SetReg1(Part1Port,0x0D,tempcl); /*BTVGA2HRE 0x0D */ + tempcx=(VGAVT-1); + tempah=tempcx&0x0FF; + if(IF_DEF_CH7005==1) { + if(VBInfo&0x0C) tempah=tempah-1; + } + SetReg1(Part1Port,0x0E,tempah); /*BTVGA2TV 0x0E,0x12 */ + tempbx=VGAVDE-1; + tempah=tempbx&0x0FF; + if(IF_DEF_CH7005==1) { + if(VBInfo&0x0C) tempah=tempah-1; + } + SetReg1(Part1Port,0x0F,tempah); /*BTVGA2VDEE 0x0F,0x12 */ + tempah=((tempbx&0xFF00)<<3)>>8; + tempah=tempah|((tempcx&0xFF00)>>8); + SetReg1(Part1Port,0x12,tempah); + + tempbx=(VGAVT+VGAVDE)>>1; /*BTVGA2VRS 0x10,0x11 */ + tempcx=((VGAVT-VGAVDE)>>4)+tempbx+1; /*BTVGA2VRE 0x11 */ + + tempah=tempbx&0x0FF; + SetReg1(Part1Port,0x10,tempah); + tempbh=(tempbx&0xFF00)>>8; + tempah=((tempbh<<4)&0x0FF)|(tempcx&0x0F); + SetReg1(Part1Port,0x11,tempah); + + SetRegANDOR(Part1Port,0x13,~0x03C,tempah); + + /*lines below are newly added for LVDS */ + tempax=LCDHDES; + tempbx=HDE; + tempcx=HT; + tempcx=tempcx-tempbx; /*HT-HDE */ + /*push ax lcdhdes */ + tempax=tempax+tempbx; /*lcdhdee */ + tempbx=HT; + if(tempax>=tempbx){ + tempax=tempax-tempbx; + } + /*push ax lcdhdee */ + lcdhdee=tempax; + tempcx=tempcx>>2; /*temp */ + tempcx=tempcx+tempax; /*lcdhrs */ + if(tempcx>=tempbx){ + tempcx=tempcx-tempbx; + } + /* v ah,cl */ + tempax=tempcx; + tempax=tempax>>3; /*BPLHRS */ + tempah=tempax&0x0FF; + SetReg1(Part1Port,0x14,tempah); /*Part1_14h */ + tempah=tempah+2; + tempah=tempah+0x01F; + tempcl=tempcx&0x0FF; + tempcl=tempcl&0x07; + tempcl=(tempcl<<5)&0xFF; /* PHLHSKEW */ + tempah=tempah|tempcl; + SetReg1(Part1Port,0x15,tempah); /*Part1_15h */ + tempbx=lcdhdee; /*lcdhdee */ + tempcx=LCDHDES; /*lcdhdes */ + tempah=(tempcx&0xFF); + tempah=tempah&0x07; /*BPLHDESKEW */ + SetReg1(Part1Port,0x1A,tempah); /*Part1_1Ah */ + tempcx=tempcx>>3; /*BPLHDES */ + tempah=(tempcx&0xFF); + SetReg1(Part1Port,0x16,tempah); /*Part1_16h */ + tempbx=tempbx>>3; /*BPLHDEE */ + tempah=tempbx&0xFF; + SetReg1(Part1Port,0x17,tempah); /*Part1_17h */ + + tempcx=VGAVT; + tempbx=VGAVDE; + tempcx=tempcx-tempbx; /* GAVT-VGAVDE */ + tempbx=LCDVDES; /*VGAVDES */ + temppush1=tempbx; /*push bx temppush1 */ + if(IF_DEF_TRUMPION==0){ + if(IF_DEF_CH7005==1) tempax=VGAVDE; + if(VBInfo&SetCRT2ToLCD) { + if(LCDResInfo==Panel800x600) tempax=600; + else tempax=768; + } + } + else tempax=VGAVDE; + tempbx=tempbx+tempax; + tempax=VT; /*VT */ + if(tempbx>=VT){ + tempbx=tempbx-tempax; + } + temppush2=tempbx; /*push bx temppush2 */ + tempcx=tempcx>>1; + tempbx=tempbx+tempcx; + tempbx++; /*BPLVRS */ + if(tempbx>=tempax){ + tempbx=tempbx-tempax; + } + tempah=tempbx&0xFF; + SetReg1(Part1Port,0x18,tempah); /*Part1_18h */ + tempcx=tempcx>>3; + tempcx=tempcx+tempbx; + tempcx++; /*BPLVRE */ + tempah=tempcx&0xFF; + tempah=tempah&0x0F; + tempah=tempah|0x030; + SetRegANDOR(Part1Port,0x19,~0x03F,tempah); /*Part1_19h */ + tempbh=(tempbx&0xFF00)>>8; + tempbh=tempbh&0x07; + tempah=tempbh; + tempah=(tempah<<3)&0xFF; /*BPLDESKEW =0 */ + /*movzx */ + tempbx=VGAVDE; + if(tempbx!=VDE){ + tempah=tempah|0x40; + } + SetRegANDOR(Part1Port,0x1A,0x07,tempah); /*Part1_1Ah */ + tempecx=VGAVT; + tempebx=VDE; + tempeax=VGAVDE; + tempecx=tempecx-tempeax; /*VGAVT-VGAVDE */ + tempeax=tempeax*64; + templong=tempeax/tempebx; + if(templong*tempebx<tempeax){ + templong++; + } + tempebx=templong; /*BPLVCFACT */ + if(SetFlag&EnableLVDSDDA){ + tempebx=tempebx&0x03F; + } + tempah=(UShort)(tempebx&0x0FF); + SetReg1(Part1Port,0x1E,tempah); /*Part1_1Eh */ + tempbx=temppush2; /* p bx temppush2 BPLVDEE */ + tempcx=temppush1; /*pop cx temppush1 NPLVDES */ + tempbh=(tempbx&0xFF00)>>8; + tempah=tempah&0x07; + tempah=tempbh; + tempah=tempah<<3; + tempch=(tempcx&0xFF00)>>8; + tempch=tempch&0x07; + tempah=tempah|tempch; + SetReg1(Part1Port,0x1D,tempah); /*Part1_1Dh */ + tempah=tempbx&0xFF; + SetReg1(Part1Port,0x1C,tempah); /*Part1_1Ch */ + tempah=tempcx&0xFF; + SetReg1(Part1Port,0x1B,tempah); /*Part1_1Bh */ + + tempecx=VGAHDE; + tempebx=HDE; + tempeax=tempecx; + tempeax=tempeax<<6; + tempeax=tempeax<<10; + tempeax=tempeax/tempebx; + if(tempebx==tempecx){ + tempeax=65535; + } + tempecx=tempeax; + tempeax=VGAHT; + tempeax=tempeax<<6; + tempeax=tempeax<<10; + tempeax=tempeax/tempecx; + tempecx=tempecx<<16; + tempeax=tempeax-1; + tempax=(UShort)(tempeax&0x00FFFF); + tempcx=tempax; + tempah=tempcx&0x0FF; + SetReg1(Part1Port,0x1F,tempah); /*Part1_1Fh */ + tempbx=VDE; + tempbx--; /*BENPLACCEND */ + if(SetFlag&EnableLVDSDDA){ + tempbx=1; + } + tempah=(tempbx&0xFF00)>>8; + tempah=(tempah<<3)&0xFF; + tempch=(tempcx&0xFF00)>>8; + tempch=tempch&0x07; + tempah=tempah|tempch; + SetReg1(Part1Port,0x20,tempah); /*Part1_20h */ + tempah=tempbx&0xFF; + SetReg1(Part1Port,0x21,tempah); /*Part1_21h */ + tempecx=tempecx>>16; /*BPLHCFACT */ + temp1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(temp1&HalfDCLK){ + tempecx=tempecx>>1; + } + tempcx=(UShort)(tempecx&0x0FFFF); + tempah=(tempcx&0xFF00)>>8; + SetReg1(Part1Port,0x22,tempah); /*Part1_22h */ + tempah=tempcx&0x0FF; + SetReg1(Part1Port,0x23,tempah); /*Part1_23h */ + if(IF_DEF_TRUMPION==1){ + tempal=(UShort)*((UChar *)(ROMAddr+ModeIDOffset+0x05)); /* si+St_ResInfo */ + if(ModeNo>0x13){ + SetFlag=SetFlag|ProgrammingCRT2; + GetRatePtrCRT2(ROMAddr,ModeNo); + tempal=*((UChar *)(ROMAddr+REFIndex+0x04)); /* di+Ext_CRT2CRTC */ + tempal=tempal&0x1F; + } + tempah=0x80; + tempal=tempal*tempah; + REFIndex= offset_Zurac; /*offset Zurac need added in rompost.asm */ + REFIndex=REFIndex+tempal; + SetTPData(); /*this function not implemented yet */ + } + + REFIndex=OldREFIndex; /*pop di */ + + return; +} + +static void SetTPData(void) +{ + return; +} + + +static void SetGroup1_301(UShort BaseAddr,ULong ROMAddr,UShort ModeNo,ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + UShort temp1,temp2,tempcl,tempch,tempbl,tempbh,tempal,tempah,tempax,tempbx; + UShort tempcx,OldREFIndex; + UShort Part1Port,resinfo,modeflag; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + OldREFIndex=REFIndex; /* push di */ + + SetCRT2Offset(Part1Port,ROMAddr); + SetCRT2FIFO(Part1Port,ROMAddr,ModeNo,pScrn); + SetCRT2Sync(BaseAddr,ROMAddr,ModeNo); + + GetCRT1Ptr(ROMAddr); + + temp1=(VGAHT-1)&0x0FF; /* BTVGA2HT 0x08,0x09 */ + SetReg1(Part1Port,0x08,temp1); + temp1=(((VGAHT-1)&0xFF00)>>8)<<4; + SetRegANDOR(Part1Port,0x09,~0x0F0,temp1); + + temp1=(VGAHDE+12)&0x0FF; /* BTVGA2HDEE 0x0A,0x0C */ + SetReg1(Part1Port,0x0A,temp1); + + temp1=VGAHDE+12; /* bx BTVGA@HRS 0x0B,0x0C */ + temp2=(VGAHT-VGAHDE)>>2; /* cx */ + temp1=temp1+temp2; + temp2=(temp2<<1)+temp1; + tempcl=temp2&0x0FF; + if(VBInfo&SetCRT2ToRAMDAC){ + tempbl=*((UChar *)(ROMAddr+REFIndex+4)); /* di+4 */ + tempbh=*((UChar *)(ROMAddr+REFIndex+14)); /* di+14 */ + temp1=((tempbh>>6)<<8)|tempbl; /* temp1->bx */ + temp1=(temp1-1)<<3; + tempcl=*((UChar *)(ROMAddr+REFIndex+5)); /* di+5 */ + tempch=*((UChar *)(ROMAddr+REFIndex+15)); /* di+15 */ + tempcl=tempcl&0x01F; + tempch=(tempch&0x04)<<(6-2); + tempcl=((tempcl|tempch)-1)<<3; + } + SetReg1(Part1Port,0x0B,(UShort)(temp1&0x0FF)); + tempah=(temp1&0xFF00)>>8; + tempbh=((((VGAHDE+12)&0xFF00)>>8)<<4)&0x0FF; + tempah=tempah|tempbh; + SetReg1(Part1Port,0x0C,tempah); + SetReg1(Part1Port,0x0D,tempcl); /* BTVGA2HRE 0x0D */ + tempcx=(VGAVT-1); + tempah=tempcx&0x0FF; + SetReg1(Part1Port,0x0E,tempah); /* BTVGA2TV 0x0E,0x12 */ + tempbx=VGAVDE-1; + tempah=tempbx&0x0FF; + SetReg1(Part1Port,0x0F,tempah); /* BTVGA2VDEE 0x0F,0x12 */ + tempah=((tempbx&0xFF00)<<3)>>8; + tempah=tempah|((tempcx&0xFF00)>>8); + SetReg1(Part1Port,0x12,tempah); + + tempbx=(VGAVT+VGAVDE)>>1; /* BTVGA2VRS 0x10,0x11 */ + tempcx=((VGAVT-VGAVDE)>>4)+tempbx+1; /* BTVGA2VRE 0x11 */ + if(VBInfo&SetCRT2ToRAMDAC){ + tempbx=*((UChar *)(ROMAddr+REFIndex+8)); /* di+8 */ + temp1=*((UChar *)(ROMAddr+REFIndex+7)); /* di+7 */ + if(temp1&0x04){ + tempbx=tempbx|0x0100; + } + if(temp1&0x080){ + tempbx=tempbx|0x0200; + } + temp1=*((UChar *)(ROMAddr+REFIndex+13)); /* di+13 */ + if(temp1&0x08){ + tempbx=tempbx|0x0400; + } + tempcl= *((UChar *)(ROMAddr+REFIndex+9)); /* di+9 */ + tempcx=(tempcx&0xFF00)|(tempcl&0x00FF); + } + tempah=tempbx&0x0FF; + SetReg1(Part1Port,0x10,tempah); + tempbh=(tempbx&0xFF00)>>8; + tempah=((tempbh<<4)&0x0FF)|(tempcx&0x0F); + SetReg1(Part1Port,0x11,tempah); + + if( pSiS->Chipset == PCI_CHIP_SIS300 ){ + tempah=0x10; + if((LCDResInfo!=Panel1024x768)&&(LCDResInfo==Panel1280x1024)) tempah=0x20; + } + else tempah=0x20; + if(VBInfo&SetCRT2ToTV) tempah=0x08; +/* ynlai begin */ + if(IF_DEF_HiVision==1) { + if(VBInfo&SetInSlaveMode) tempah=0x2c; + else tempah=0x20; + } +/* ynlai end */ + SetRegANDOR(Part1Port,0x13,~0x03C,tempah); + + if(!(VBInfo&SetInSlaveMode)){ + REFIndex=OldREFIndex; + return; + } + if(VBInfo&SetCRT2ToTV){ + tempax=0xFFFF; + }else{ + tempax=GetVGAHT2(); + } + tempcl=0x08; /* Reg 0x03 Horozontal Total */ + temp1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(!(temp1&Charx8Dot)){ /* temp1->St_ModeFlag */ + tempcl=0x09; + } + if(tempax>=VGAHT){ + tempax=VGAHT; + } + if(temp1&HalfDCLK){ + tempax=tempax>>1; + } + tempax=(tempax/tempcl)-5; + tempbl=tempax; + tempah=0xFF; /* set MAX HT */ + SetReg1(Part1Port,0x03,tempah); + + tempax=VGAHDE; /* 0x04 Horizontal Display End */ + if(temp1&HalfDCLK){ + tempax=tempax>>1; + } + tempax=(tempax/tempcl)-1; + tempbh=tempax; + SetReg1(Part1Port,0x04,tempax); + + tempah=tempbh; + if(VBInfo&SetCRT2ToTV){ + tempah=tempah+2; + } +/* ynlai begin */ + if(IF_DEF_HiVision==1) { + resinfo=*(UShort *)(ROMAddr+ModeIDOffset+0x09); /* si+Ext_ResInfo */ + if(resinfo==7) tempah=tempah-2; + } +/* ynlai end */ + SetReg1(Part1Port,0x05,tempah); /* 0x05 Horizontal Display Start */ + SetReg1(Part1Port,0x06,0x03); /* 0x06 Horizontal Blank end */ + /* 0x07 horizontal Retrace Start */ +/* ynlai begin */ + if(IF_DEF_HiVision==1) { + tempah=tempbl-1; + modeflag=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(!(modeflag&HalfDCLK)) { + tempah=tempah-6; + if(SetFlag&TVSimuMode) { + tempah=tempah-4; + if(ModeNo>0x13) tempah=tempah-10; + } + } + } +/* ynlai end */ + else { + tempcx=(tempbl+tempbh)>>1; + tempah=(tempcx&0xFF)+2; + + if(VBInfo&SetCRT2ToTV){ + tempah=tempah-1; + if(!(temp1&HalfDCLK)){ + if((temp1&Charx8Dot)){ + tempah=tempah+4; + if(VGAHDE>=800){ + tempah=tempah-6; + } + } + } + }else{ + if(!(temp1&HalfDCLK)){ + tempah=tempah-4; + if(VGAHDE>=800){ + tempah=tempah-7; + if(ModeType==ModeEGA){ + if(VGAVDE==1024){ + tempah=tempah+15; + if(LCDResInfo!=Panel1280x1024){ + tempah=tempah+7; + } + } + } + if(VGAHDE>=1280){ + tempah=tempah+28; + } + } + } + } + } + SetReg1(Part1Port,0x07,tempah); /* 0x07 Horizontal Retrace Start */ + + SetReg1(Part1Port,0x08,0); /* 0x08 Horizontal Retrace End */ + SetReg1(Part1Port,0x18,0x03); /* 0x18 SR08 */ + SetReg1(Part1Port,0x19,0); /* 0x19 SR0C */ + SetReg1(Part1Port,0x09,0xFF); /* 0x09 Set Max VT */ + + tempcx=0x121; + tempcl=0x21; + tempch=0x01; + tempbx=VGAVDE; /* 0x0E Virtical Display End */ + if(tempbx==360) tempbx=350; + if(tempbx==375) tempbx=350; + if(tempbx==405) tempbx=400; + tempbx--; + tempah=tempbx&0x0FF; + SetReg1(Part1Port,0x0E,tempah); + SetReg1(Part1Port,0x10,tempah); /* 0x10 vertical Blank Start */ + tempbh=(tempbx&0xFF00)>>8; + if(tempbh&0x01){ + tempcl=tempcl|0x0A; + } + tempah=0;tempal=0x0B; + if(temp1&DoubleScanMode){ + tempah=tempah|0x080; + } + if(tempbh&0x02){ + tempcl=tempcl|0x040; + tempah=tempah|0x020; + } + SetReg1(Part1Port,0x0B,tempah); + if(tempbh&0x04){ + tempch=tempch|0x06; + } + + SetReg1(Part1Port,0x11,0); /* 0x11 Vertival Blank End */ + + tempax=VGAVT-tempbx; /* 0x0C Vertical Retrace Start */ + tempax=tempax>>2; + temp2=tempax; /* push ax */ + tempax=tempax<<1; + tempbx=tempax+tempbx; +/* ynlai begin */ +/* ynlai end */ + if((SetFlag&TVSimuMode)&&(VBInfo&SetPALTV)&&(VGAHDE==800)){ + tempbx=tempbx+40; + } + tempah=(tempbx&0x0FF); + SetReg1(Part1Port,0x0C,tempah); + tempbh=(tempbx&0xFF00)>>8; + if(tempbh&0x01){ + tempcl=tempcl|0x04; + } + if(tempbh&0x02){ + tempcl=tempcl|0x080; + } + if(tempbh&0x04){ + tempch=tempch|0x08; + } + + tempax=temp2; /* pop ax */ + tempax=(tempax>>2)+1; + tempbx=tempbx+tempax; + tempah=(tempbx&0x0FF)&0x0F; + SetReg1(Part1Port,0x0D,tempah); /* 0x0D vertical Retrace End */ + tempbl=tempbx&0x0FF; + if(tempbl&0x10){ + tempch=tempch|0x020; + } + + tempah=tempcl; + SetReg1(Part1Port,0x0A,tempah); /* 0x0A CR07 */ + tempah=tempch; + SetReg1(Part1Port,0x17,tempah); /* 0x17 SR0A */ + tempax=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + tempah=(tempax&0xFF00)>>8; + tempah=(tempah>>1)&0x09; + SetReg1(Part1Port,0x16,tempah); /* 0x16 SR01 */ + SetReg1(Part1Port,0x0F,0); /* 0x0F CR14 */ + SetReg1(Part1Port,0x12,0); /* 0x12 CR17 */ + SetReg1(Part1Port,0x1A,0); /* 0x1A SR0E */ + + REFIndex=OldREFIndex; /* pop di */ +} + +static void SetCRT2Offset(UShort Part1Port,ULong ROMAddr) +{ + UShort offset; + if(VBInfo&SetInSlaveMode){ + return; + } + offset=GetOffset(ROMAddr); + SetReg1(Part1Port,0x07,(UShort)(offset&0xFF)); + SetReg1(Part1Port,0x09,(UShort)((offset&0xFF00)>>8)); + SetReg1(Part1Port,0x03,(UShort)(((offset>>3)&0xFF)+1)); +} + +static UShort GetOffset(ULong ROMAddr) +{ + UShort tempal,temp1,colordepth; + tempal=*((UChar *)(ROMAddr+ModeIDOffset+0x03)); /* si+Ext_ModeInfo */ + tempal=(tempal>>4)&0xFF; + ScreenOffset=*((UShort *)(ROMAddr+0x206)); /* Get ScreeOffset table */ + tempal=*((UChar *)(ROMAddr+ScreenOffset+tempal)); /* get ScreenOffset */ + tempal=tempal&0xFF; + temp1=*((UChar *)(ROMAddr+REFIndex)); /* di+Ext_InfoFlag */ + if(temp1&InterlaceMode){ + tempal=tempal<<1; + } + colordepth=GetColorDepth(ROMAddr); + return(tempal*colordepth); +} + +static UShort GetColorDepth(ULong ROMAddr) +{ + UShort ColorDepth[6]={1,2,4,4,6,8}; + UShort temp; + int temp1; + temp=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + temp1=(temp&ModeInfoFlag)-ModeEGA; + if(temp1<0) temp1=0; + return(ColorDepth[temp1]); +} + +static void SetCRT2FIFO(UShort Part1Port,ULong ROMAddr,UShort ModeNo,ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + UShort temp,temp1,temp2,temp3,flag; + UShort vclk2ptr,latencyindex; + UShort oldREFIndex,CRT1ModeNo,oldModeIDOffset; + long int longtemp; + + static UShort LatencyFactor[48]={ 88, 80, 78, 72, 70, 00, /* 64 bit BQ=2 */ + 00, 79, 77, 71, 69, 49, /* 64 bit BQ=1 */ + 88, 80, 78, 72, 70, 00, /* 128 bit BQ=2 */ + 00, 72, 70, 64, 62, 44, /* 128 bit BQ=1 */ + 73, 65, 63, 57, 55, 00, /* 64 bit BQ=2 */ + 00, 64, 62, 56, 54, 34, /* 64 bit BQ=1 */ + 78, 70, 68, 62, 60, 00, /* 128 bit BQ=2 */ + 00, 62, 60, 54, 52, 34}; /* 128 bit BQ=1 */ + + oldREFIndex=REFIndex; /* push REFIndex(CRT2 now) */ + oldModeIDOffset=ModeIDOffset; /* push ModeIDOffset */ + + CRT1ModeNo=(UChar)GetReg1(P3d4,0x34); /* get CRT1 ModeNo */ + SearchModeID(ROMAddr,CRT1ModeNo); /* Get ModeID Table */ + + GetRatePtr(ROMAddr,CRT1ModeNo); /* Set REFIndex-> for crt1 refreshrate */ + temp1=GetVCLK(ROMAddr,CRT1ModeNo); + temp2=GetColorTh(ROMAddr); + temp3=GetMCLK(ROMAddr); + temp=((UShort)(temp1*temp2)/temp3); /* temp->bx */ + temp1=(UChar)GetReg1(P3c4,0x14); /* SR_14 */ + temp1=temp1>>6; + temp1=temp1<<1; + if(temp1==0) temp1=1; + temp1=temp1<<2; /* temp1->ax */ + + longtemp=temp1-temp; + + temp2=(UShort)((28*16)/(int)longtemp); /* temp2->cx */ + if(!((temp2*(int)longtemp)==(28*16))) temp2++; + + if( pSiS->Chipset == PCI_CHIP_SIS300 ){ + temp1=CalcDelayVB(); + }else{ /* for Trojan and Spartan */ + flag=(UChar)GetReg1(P3c4,0x14); /* SR_14 */ + if(flag&0x80){ + latencyindex=12; /* 128 bit */ + }else{ + latencyindex=0; /* 64 bit */ + } + flag=GetQueueConfig(); + if(!(flag&0x01)){ + latencyindex+=24; /* GUI timing =0 */ + } + if(flag&0x10){ + latencyindex+=6; /* BQ =2 */ + } + latencyindex=latencyindex + (flag>>5); + temp1= LatencyFactor[latencyindex]; + temp1=temp1+15; + flag=(UChar)GetReg1(P3c4,0x14); /* SR_14 */ + if(!(flag&0x80)){ + temp1=temp1+5; /* 64 bit */ + } + } + + temp2=temp2+temp1; + REFIndex=oldREFIndex; /* pop REFIndex(CRT2) */ + ModeIDOffset=oldModeIDOffset; /* pop ModeIDOffset */ + + vclk2ptr=GetVCLK2Ptr(ROMAddr,ModeNo); + temp1=*((UShort *)(ROMAddr+vclk2ptr+(VCLKLen-2))); + temp3=GetColorTh(ROMAddr); + longtemp=temp1*temp2*temp3; + temp3=GetMCLK(ROMAddr); + temp3=temp3<<4; + temp2=(int)(longtemp/temp3); + if((long int)temp2*(long int)temp3<(long int)longtemp) + temp2++; /* temp2->cx */ + + temp1=(UChar)GetReg1(Part1Port,0x01); /* part1port index 01 */ + temp1=(temp1&(~0x1F))|0x16; + SetReg1(Part1Port,0x01,temp1); + +/* ynlai begin */ + if(IF_DEF_HiVision==1) { if(temp2<=10) temp2=10; } + else { if(temp2<=6) temp2=6; } +/* ynlai end */ + if(temp2>0x14) temp2=0x14; + temp1=(UChar)GetReg1(Part1Port,0x02); /* part1port index 02 */ + temp1=(temp1&(~0x1F))|temp2; + SetReg1(Part1Port,0x02,temp1); +} + +static UShort GetVCLK(ULong ROMAddr,UShort ModeNo) +{ + UShort tempptr; + UShort temp1; + tempptr=GetVCLKPtr(ROMAddr,ModeNo); + temp1=*((UShort *)(ROMAddr+tempptr+(VCLKLen-2))); + return temp1; +} + +static UShort GetQueueConfig(void) +{ + UShort tempal,tempbl; + ULong tempeax; + + SetReg4(0xcf8,0x80000050); + tempeax=GetReg3(0xcfc); + tempeax=(tempeax>>24)&0x0f; + tempbl=(UShort)tempeax; + tempbl=tempbl<<4; + + SetReg4(0xcf8,0x800000A0); + tempeax=GetReg3(0xcfc); + tempeax=(tempeax>>24)&0x0f; + tempal=(UShort)tempeax; + tempbl=tempbl|tempal; + + return(tempbl); +} + +static UShort GetVCLKPtr(ULong ROMAddr,UShort ModeNo) +{ + UShort tempal=0; + if(IF_DEF_LVDS==0) { + tempal=(UChar)GetReg2((UShort)(P3ca+0x02)); /* Port 3cch */ + tempal=((tempal>>2)&0x03); + if(ModeNo>0x13){ + tempal=*((UChar *)(ROMAddr+REFIndex+0x03)); /* di+Ext_CRTVCLK */ + } + VCLKLen=GetVCLKLen(ROMAddr); + tempal=tempal*VCLKLen; + tempal=tempal+(*((UShort *)(ROMAddr+0x208))); /* VCLKData */ + return ((UShort)tempal); + } else { + if(LCDResInfo==Panel800x600) { + tempal=VCLK40; + } else if(LCDResInfo==Panel1024x768) { + tempal=VCLK65; + } + VCLKLen=GetVCLKLen(ROMAddr); + tempal=tempal*VCLKLen; + tempal=tempal+(*((UShort *)(ROMAddr+0x208))); + return((UShort)tempal); + } +} + +static UShort GetColorTh(ULong ROMAddr) +{ + UShort temp; + temp=GetColorDepth(ROMAddr); + temp=temp>>1; + if(temp==0) temp++; + return temp; +} + +static UShort GetMCLK(ULong ROMAddr) +{ + UShort tempmclkptr; + UShort tempmclk; + tempmclkptr=GetMCLKPtr(ROMAddr); + tempmclk=*((UShort *)(ROMAddr+tempmclkptr+0x03)); /* di+3 */ + return tempmclk; +} + +static UShort GetMCLKPtr(ULong ROMAddr) +{ + UShort tempdi; + UShort tempdramtype,tempax; + + tempdi=*((UShort *)(ROMAddr+0x20C)); /* MCLKData */ + tempdramtype=GetDRAMType(ROMAddr); + tempax=5*tempdramtype; + tempdi=tempdi+tempax; + return (tempdi); +} + +static UShort GetDRAMType(ULong ROMAddr) +{ + UShort tsoftsetting,temp3; + tsoftsetting=*((UChar *)(ROMAddr+0x52)); + if(!(tsoftsetting&SoftDramType)){ + temp3=(UChar)GetReg1(P3c4,0x3A); + tsoftsetting=temp3; + } + tsoftsetting=tsoftsetting&0x07; + return(tsoftsetting); +} + +static UShort CalcDelayVB(void) +{ + UShort tempal,tempah,temp1,tempbx; + UShort ThTiming[8]={1,2,2,3,0,1,1,2}; + UShort ThLowB[24]={81,4,72,6,88,8,120,12, + 55,4,54,6,66,8,90,12, + 42,4,45,6,55,8,75,12}; + + tempah=(UChar)GetReg1(P3c4,0x18); /* SR_18 */ + tempah=tempah&0x62; + tempah=tempah>>1; + tempal=tempah; + tempah=tempah>>3; + tempal=tempal|tempah; + tempal=tempal&0x07; + + temp1=ThTiming[tempal]; /* temp1->cl */ + + tempbx=(UChar)GetReg1(P3c4,0x16); /* SR_16 */ + tempbx=tempbx>>6; + tempah=(UChar)GetReg1(P3c4,0x14); /* SR_14 */ + tempah=((tempah>>4)&0x0C); + tempbx=((tempbx|tempah)<<1); + + tempal=ThLowB[tempbx+1]*temp1; + tempbx=ThLowB[tempbx]; + tempbx=tempal+tempbx; + + return(tempbx); +} + +static UShort GetVCLK2Ptr(ULong ROMAddr,UShort ModeNo) +{ + UShort tempal,tempbx,temp; + UShort LCDXlat1VCLK[4]={VCLK65,VCLK65,VCLK65,VCLK65}; + UShort LCDXlat2VCLK[4]={VCLK108_2,VCLK108_2,VCLK108_2,VCLK108_2}; + UShort LVDSXlat1VCLK[4]={VCLK40,VCLK40,VCLK40,VCLK40}; + UShort LVDSXlat2VCLK[4]={VCLK65,VCLK65,VCLK65,VCLK65}; + UShort LVDSXlat3VCLK[4]={VCLK65,VCLK65,VCLK65,VCLK65}; + + if(IF_DEF_LVDS==0) { + if(ModeNo<=0x13){ + tempal=*((UChar *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ + }else{ + tempal=*((UChar *)(ROMAddr+REFIndex+0x04)); /* di+Ext_CRT2CRTC */ + } + tempal=tempal>>6; + if(LCDResInfo!=Panel1024x768){ + tempal=LCDXlat2VCLK[tempal]; + }else{ + tempal=LCDXlat1VCLK[tempal]; + } + + if(VBInfo&SetCRT2ToLCD){ + tempal=tempal; + } +/* ynlai begin */ + else { /* for TV */ + if(VBInfo&SetCRT2ToTV) { + if(IF_DEF_HiVision==1) { + if(SetFlag&RPLLDIV2XO) tempal=HiTVVCLKDIV2; + else tempal=HiTVVCLK; + if(SetFlag&TVSimuMode){ + temp=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(temp&Charx8Dot) tempal=HiTVSimuVCLK; + else tempal=HiTVTextVCLK; + } + } + else { + if(VBInfo&SetCRT2ToTV){ + if(SetFlag&RPLLDIV2XO) tempal=TVVCLKDIV2; + else tempal=TVVCLK; + } + else { + tempal=(UChar)GetReg2((UShort)(P3ca+0x02)); /* Port 3cch */ + tempal=((tempal>>2)&0x03); + if(ModeNo>0x13) tempal=*((UChar *)(ROMAddr+REFIndex+0x03)); /* di+Ext_CRTVCLK */ + } + } + } + } + } +/* ynlai end */ + else { /* LVDS */ + if(ModeNo<=0x13) tempal=*((UChar *)(ROMAddr+ModeIDOffset+0x04)); + else tempal=*((UChar *)(ROMAddr+REFIndex+0x04)); + if(IF_DEF_CH7005==1) { + if(!(VBInfo&SetCRT2ToLCD)) { + tempal=tempal&0x1f; + tempbx=0; + if(VBInfo&SetPALTV) tempbx=tempbx+2; + if(VBInfo&SetCHTVOverScan) tempbx=tempbx+1; + tempbx=tempbx<<1; + temp=(*((UShort *)(ROMAddr+ADR_CHTVVCLKPtr))); + tempbx=(*((UShort *)(ROMAddr+temp+tempbx))); + tempal=(*((UShort *)(ROMAddr+tempbx+tempal))); + tempal=tempal&0x00FF; + } + } + else { + tempal=tempal>>6; + if(LCDResInfo==Panel800x600) tempal=LVDSXlat1VCLK[tempal]; + else if(LCDResInfo==Panel1024x768) tempal=LVDSXlat2VCLK[tempal]; + else tempal=LVDSXlat3VCLK[tempal]; + } + } + VCLKLen=GetVCLKLen(ROMAddr); + tempal=tempal*VCLKLen; + tempal=tempal+(*((UShort *)(ROMAddr+0x208))); /* VCLKData */ + return ((UShort)tempal); +} + +static UShort GetVCLKLen(ULong ROMAddr) +{ + UShort VCLKDataStart,vclklabel,temp; + VCLKDataStart=*((UShort *)(ROMAddr+0x208)); + for(temp=0;;temp++){ + vclklabel=*((UShort *)(ROMAddr+VCLKDataStart+temp)); + if(vclklabel==VCLKStartFreq){ + temp=temp+2; + return(temp); + } + } + return(0); +} + + +static void SetCRT2Sync(UShort BaseAddr,ULong ROMAddr,UShort ModeNo) +{ + UShort temp1,tempah=0; + UShort temp; + UShort Part1Port; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + if(IF_DEF_LVDS==1){ + if(VBInfo&SetCRT2ToLCD){ + tempah=LCDInfo; + if(!(tempah&LCDSync)){ + temp=*((UShort *)(ROMAddr+REFIndex)); /*di+Ext_InfoFlag */ + tempah=(temp>>8)&0x0C0; + }else{ + tempah=tempah&0x0C0; + } + } + } + else { + temp=*((UShort *)(ROMAddr+REFIndex)); /* di+Ext_InfoFlag */ + tempah=(temp>>8)&0x0C0; + } + temp1=(UChar)GetReg1(Part1Port,0x19); /* part1port index 02 */ + temp1=(temp1&(~0x0C0))|tempah; + SetReg1(Part1Port,0x19,temp1); +} + +static void GetCRT1Ptr(ULong ROMAddr) +{ + UShort temprefcrt1; + UShort temp; + temp=*((UChar *)(ROMAddr+REFIndex+0x02)); /* di+Ext_CRT1CRTC */ + temp=temp*CRT1Len; + temprefcrt1=*((UShort *)(ROMAddr+0x204)); /* Get CRT1Table */ + REFIndex=temprefcrt1+temp; /* di->CRT1Table+Ext_CRT1CRTC*CRT1Len */ +} + +static void SetRegANDOR(UShort Port,UShort Index,UShort DataAND,UShort DataOR) +{ + UShort temp1; + temp1=GetReg1(Port,Index); /* part1port index 02 */ + temp1=(temp1&(DataAND))|DataOR; + SetReg1(Port,Index,temp1); +} + +static UShort GetVGAHT2(void) +{ + long int temp1,temp2; + temp1=(VGAVT-VGAVDE)*RVBHCMAX; + temp1=temp1&0x0FFFF; + temp2=(VT-VDE)*RVBHCFACT; + temp2=temp2&0x0FFFF; + temp2=temp2*HT; + temp2=temp2/temp1; + return((UShort)temp2); +} + +static void SetGroup2(UShort BaseAddr,ULong ROMAddr, UShort ModeNo) +{ + UShort tempah,tempbl,tempbh,tempcl,i,j,tempcx,pushcx,tempbx,tempax; + UShort tempmodeflag,tempflowflag; + UChar *temp1; + UShort *temp2; + UShort pushbx; + UShort Part2Port; + UShort modeflag; + long int longtemp; + + Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; + tempcx=VBInfo; + tempah=VBInfo&0x0FF; + tempbl=VBInfo&0x0FF; + tempbh=VBInfo&0x0FF; + tempbx=(tempbl&0xFF)|(tempbh<<8); + tempbl=tempbl&0x10; + tempbh=(tempbh&0x04)<<1; + tempah=(tempah&0x08)>>1; + tempah=tempah|tempbh; + tempbl=tempbl>>3; + tempah=tempah|tempbl; + tempah=tempah^0x0C; + + if(IF_DEF_HiVision==1) { + temp1=(UChar *)(ROMAddr+0x0F1); /* PALPhase */ + tempah=tempah^0x01; + if(VBInfo&SetInSlaveMode) { + temp2=HiTVSt2Timing; + if(SetFlag&TVSimuMode) { + modeflag=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); + if(modeflag&Charx8Dot) temp2=HiTVSt1Timing; + else temp2=HiTVTextTiming; + } + } + else temp2=HiTVExtTiming; + } + else { + if(VBInfo&SetPALTV){ + temp1=(UChar *)(ROMAddr+0x0F1); /* PALPhase */ + temp2=PALTiming; + }else{ + tempah=tempah|0x10; + temp1=(UChar *)(ROMAddr+0x0ED); /* NTSCPhase */ + temp2=NTSCTiming; + } + } + SetReg1(Part2Port,0x0,tempah); + for(i=0x31;i<=0x34;i++,temp1++){ + SetReg1(Part2Port,i,*(UChar *)temp1); + } + for(i=0x01,j=0;i<=0x2D;i++,j++){ + SetReg1(Part2Port,i,temp2[j]); + } + for(i=0x39;i<=0x45;i++,j++){ + SetReg1(Part2Port,i,temp2[j]); /* di->temp2[j] */ + } + + tempah=GetReg1(Part2Port,0x0A); + tempah=tempah|NewFlickerMode; + SetReg1(Part2Port,0x0A,tempah); + + SetReg1(Part2Port,0x35,RY1COE); + SetReg1(Part2Port,0x36,RY2COE); + SetReg1(Part2Port,0x37,RY3COE); + SetReg1(Part2Port,0x38,RY4COE); + +/* ynlai begin */ + if(IF_DEF_HiVision==1) tempax=950; + else { + if(VBInfo&SetPALTV) tempax=520; + else tempax=440; + } + if(VDE<=tempax) { + tempax=tempax-VDE; + tempax=tempax>>2; + tempah=(tempax&0xFF00)>>8; + tempah=tempah+temp2[0]; + SetReg1(Part2Port,0x01,tempah); + tempah=tempax&0x00FF; + tempah=tempah+temp2[1]; + SetReg1(Part2Port,0x02,tempah); + } +/* begin end */ + + tempcx=HT-1; + tempah=tempcx&0xFF; + SetReg1(Part2Port,0x1B,tempah); + tempah=(tempcx&0xFF00)>>8; + SetRegANDOR(Part2Port,0x1D,~0x0F,(UChar)tempah); + + tempcx=HT>>1; + pushcx=tempcx; /* push cx */ + + tempcx=tempcx+7; +/* ynlai begin */ + if(IF_DEF_HiVision==1) tempcx=tempcx-4; +/* ynlai end */ + tempah=(tempcx&0xFF); + tempah=(tempah<<4)&0xFF; + SetRegANDOR(Part2Port,0x22,~0x0F0,tempah); + + + tempbx=temp2[j]; + tempbx=tempbx+tempcx; + tempah=tempbx&0xFF; + SetReg1(Part2Port,0x24,tempah); + tempah=(tempbx&0xFF00)>>8; + tempah=(tempah<<4)&0xFF; + SetRegANDOR(Part2Port,0x25,~0x0F0,tempah); + + tempbx=tempbx+8; +/* ynlai begin */ + if(IF_DEF_HiVision==1) { + tempbx=tempbx-4; + tempcx=tempbx; + } +/* ynlai end */ + tempah=((tempbx&0xFF)<<4)&0xFF; + SetRegANDOR(Part2Port,0x29,~0x0F0,tempah); + + tempcx=tempcx+temp2[++j]; + tempah=tempcx&0xFF; + SetReg1(Part2Port,0x27,tempah); + tempah=(((tempcx&0xFF00)>>8)<<4)&0xFF; + SetRegANDOR(Part2Port,0x28,~0x0F0,tempah); + + tempcx=tempcx+8; +/* ynlai begin */ + if(IF_DEF_HiVision==1) tempcx=tempcx-4; +/* ynlai end */ + tempah=tempcx&0xFF; + tempah=(tempah<<4)&0xFF; + SetRegANDOR(Part2Port,0x2A,~0x0F0,tempah); + + tempcx=pushcx; /* pop cx */ + tempcx=tempcx-temp2[++j]; + tempah=tempcx&0xFF; + tempah=(tempah<<4)&0xFF; + SetRegANDOR(Part2Port,0x2D,~0x0F0,tempah); + + tempcx=tempcx-11; + if(!(VBInfo&SetCRT2ToTV)){ + tempax=GetVGAHT2(); + tempcx=tempax-1; + } + tempah=tempcx&0xFF; + SetReg1(Part2Port,0x2E,tempah); + + tempbx=VDE; + if(VGAVDE==360){ + tempbx=746; + } + if(VGAVDE==375){ + tempbx=746; + } + if(VGAVDE==405){ + tempbx=853; + } + /* assuming <<ifndef>> HivisionTV */ + if((VBInfo&SetCRT2ToTV)){ + tempbx=tempbx>>1; + } + + tempbx=tempbx-2; + tempah=tempbx&0xFF; +/* ynlai begin */ + if(IF_DEF_HiVision==1) + if(VBInfo&SetInSlaveMode) + if(ModeNo==0x2f) tempah=tempah+1; +/* ynlai end */ + SetReg1(Part2Port,0x2F,tempah); + + tempah=(tempcx&0xFF00)>>8; + tempbh=(tempbx&0xFF00)>>8; + tempbh=(tempbh<<6)&0xFF; + tempah=tempah|tempbh; + /* assuming <<ifndef>> hivisiontv */ +/* ynlai begin */ + if(IF_DEF_HiVision==0) { + tempah=tempah|0x10; + if(!(VBInfo&SetCRT2ToSVIDEO)){ + tempah=tempah|0x20; + } + } +/* ynlai end */ + SetReg1(Part2Port,0x30,tempah); + + tempbh=0; + tempbx=tempbx&0xFF; + + tempmodeflag=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + tempflowflag=0; + if(!(tempmodeflag&HalfDCLK)){ + tempcx=VGAHDE; + if(tempcx>=HDE){ + tempbh=tempbh|0x20; + tempbx=(tempbh<<8)|(tempbx&0xFF); + tempah=0; + } + } + tempcx=0x0101; +/* ynlai begin */ + if(IF_DEF_HiVision==1) { + if(VGAHDE>=1024) { + tempcx=0x1920; + if(VGAHDE>=1280) tempcx=0x1420; + } + } +/* ynlai end */ + if(!(tempbh&0x20)){ + if(tempmodeflag&HalfDCLK){ + tempcl=((tempcx&0xFF)<<1)&0xFF; + tempcx=(tempcx&0xFF00)|tempcl; + } + pushbx=tempbx; + tempax=VGAHDE; + tempbx=(tempcx&0xFF00)>>8; + longtemp=tempax*tempbx; + tempcx=tempcx&0xFF; + longtemp=longtemp/tempcx; + longtemp=longtemp*8*1024; + tempax=(longtemp)/HDE; + if(tempax*HDE<longtemp){ + tempax=tempax+1; + }else{ + tempax=tempax; + } + tempbx=pushbx; + tempah=((tempax&0xFF00)>>8)&0x01F; + tempbh=tempbh|tempah; + tempah=tempax&0xFF; + } + + SetReg1(Part2Port,0x44,tempah); + tempah=tempbh; + SetRegANDOR(Part2Port,0x45,~0x03F,tempah); + + if(IF_DEF_HiVision==1) { + if(!(VBInfo&SetInSlaveMode)) { + SetReg1(Part2Port,0x0B,0x00); + } + } + + if(VBInfo&SetCRT2ToTV){ + return; + } + tempah=0x01; + if(LCDResInfo==Panel1280x1024){ + if(ModeType==ModeEGA){ + if(VGAHDE>=1024){ + tempah=0x02; + } + } + } + SetReg1(Part2Port,0x0B,tempah); + + tempbx=HDE-1; /* RHACTE=HDE-1 */ + tempah=tempbx&0xFF; + SetReg1(Part2Port,0x2C,tempah); + tempah=(tempbx&0xFF00)>>8; + tempah=(tempah<<4)&0xFF; + SetRegANDOR(Part2Port,0x2B,~0x0F0,tempah); + + tempbx=VDE-1; /* RTVACTEO=(VDE-1)&0xFF */ + tempah=tempbx&0xFF; + SetReg1(Part2Port,0x03,tempah); + tempah=((tempbx&0xFF00)>>8)&0x07; + SetRegANDOR(Part2Port,0x0C,~0x07,tempah); + + tempcx=VT-1; + tempah=tempcx&0xFF; /* RVTVT=VT-1 */ + SetReg1(Part2Port,0x19,tempah); + tempah=(tempcx&0xFF00)>>8; + tempah=(tempah<<5)&0xFF; + if(LCDInfo&LCDRGB18Bit){ + tempah=tempah|0x10; + } + SetReg1(Part2Port,0x1A,tempah); + + tempcx++; + if(LCDResInfo==Panel1024x768){ + tempbx=768; + }else{ + tempbx=1024; + } + + if(tempbx==VDE){ + tempax=1; + }else{ + tempax=tempbx; + tempax=(tempax-VDE)>>1; + } + tempcx=tempcx-tempax; /* lcdvdes */ + tempbx=tempbx-tempax; /* lcdvdee */ + + tempah=tempcx&0xFF; /* RVEQ1EQ=lcdvdes */ + SetReg1(Part2Port,0x05,tempah); + tempah=tempbx&0xFF; /* RVEQ2EQ=lcdvdee */ + SetReg1(Part2Port,0x06,tempah); + + tempah=(tempbx&0xFF00)>>8; + tempah=(tempah<<3)&0xFF; + tempah=tempah|((tempcx&0xFF00)>>8); + SetReg1(Part2Port,0x02,tempah); + + tempcx=(VT-VDE)>>4; /* (VT-VDE)>>4 */ + tempbx=(VT+VDE)>>1; + tempah=tempbx&0xFF; /* RTVACTEE=lcdvrs */ + SetReg1(Part2Port,0x04,tempah); + + tempah=(tempbx&0xFF00)>>8; + tempah=(tempah<<4)&0xFF; + tempbx=tempbx+tempcx+1; + tempbl=(tempbx&0x0F); + tempah=tempah|tempbl; /* RTVACTSO=lcdvrs&0x700>>4+lcdvre */ + SetReg1(Part2Port,0x01,tempah); + + tempah=GetReg1(Part2Port,0x09); + tempah=tempah&0xF0; + SetReg1(Part2Port,0x09,tempah); + + tempah=GetReg1(Part2Port,0x0A); + tempah=tempah&0xF0; + SetReg1(Part2Port,0x0A,tempah); + + tempcx=(HT-HDE)>>2; /* (HT-HDE)>>2 */ + tempbx=(HDE+7); /* lcdhdee */ + tempah=tempbx&0xFF; /* RHEQPLE=lcdhdee */ + SetReg1(Part2Port,0x23,tempah); + tempah=(tempbx&0xFF00)>>8; + SetRegANDOR(Part2Port,0x25,~0x0F,tempah); + + SetReg1(Part2Port,0x1F,0x07); /* RHBLKE=lcdhdes */ + tempah=GetReg1(Part2Port,0x20); + tempah=tempah&0x0F; + SetReg1(Part2Port,0x20,tempah); + + tempbx=tempbx+tempcx; + tempah=tempbx&0xFF; /* RHBURSTS=lcdhrs */ + SetReg1(Part2Port,0x1C,tempah); + tempah=(tempbx&0xFF00)>>8; + tempah=(tempah<<4)&0xFF; + SetRegANDOR(Part2Port,0x1D,~0x0F0,tempah); + + tempbx=tempbx+tempcx; + tempah=tempbx&0xFF; /* RHSYEXP2S=lcdhre */ + SetReg1(Part2Port,0x21,tempah); + + tempah=GetReg1(Part2Port,0x17); + tempah=tempah&0xFB; + SetReg1(Part2Port,0x17,tempah); + + tempah=GetReg1(Part2Port,0x18); + tempah=tempah&0xDF; + SetReg1(Part2Port,0x18,tempah); + return; +} + +static void SetGroup3(UShort BaseAddr,ULong ROMAddr) +{ + UShort i; + UShort *tempdi; + UShort Part3Port; + UShort modeflag; + Part3Port=BaseAddr+IND_SIS_CRT2_PORT_12; +/* ynlai begin */ + SetReg1(Part3Port,0x00,0x00); + if(VBInfo&SetPALTV){ + SetReg1(Part3Port,0x13,0xFA); + SetReg1(Part3Port,0x14,0xC8); + } + else { + SetReg1(Part3Port,0x13,0xF6); + SetReg1(Part3Port,0x14,0xBF); + } + if(IF_DEF_HiVision==1) { + tempdi=HiTVGroup3Data; + if(SetFlag&TVSimuMode) { + tempdi=HiTVGroup3Simu; + modeflag=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); + if(!(modeflag&Charx8Dot)) { + tempdi=HiTVGroup3Text; + } + } + for(i=0;i<=0x3E;i++){ + SetReg1(Part3Port,i,tempdi[i]); + } + } +/* ynlai end */ + return; +} + +static void SetGroup4(UShort BaseAddr,ULong ROMAddr,UShort ModeNo) +{ + UShort Part4Port; + UShort tempax,tempah,tempcx,tempbx,tempbh,tempch,tempmodeflag; + long int tempebx,tempeax,templong; + Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; + + tempax=0x0c; + if(VBInfo&SetCRT2ToTV){ + if(VBInfo&SetInSlaveMode){ + if(!(SetFlag&TVSimuMode)){ + SetFlag=SetFlag|RPLLDIV2XO; + tempax=tempax|0x04000; + } + }else{ + SetFlag=SetFlag|RPLLDIV2XO; + tempax=tempax|0x04000; + } + } + + if(LCDResInfo!=Panel1024x768){ + tempax=tempax|0x08000; + } + tempah=(tempax&0xFF00)>>8; + SetReg1(Part4Port,0x0C,tempah); + + tempah=RVBHCFACT; + SetReg1(Part4Port,0x13,tempah); + + tempbx=RVBHCMAX; + tempah=tempbx&0xFF; + SetReg1(Part4Port,0x14,tempah); + tempbh=(((tempbx&0xFF00)>>8)<<7)&0xFF; + + tempcx=VGAHT-1; + tempah=tempcx&0xFF; + SetReg1(Part4Port,0x16,tempah); + tempch=(((tempcx&0xFF00)>>8)<<3)&0xFF; + tempbh=tempbh|tempch; + + tempcx=VGAVT-1; + if(!(VBInfo&SetCRT2ToTV)){ + tempcx=tempcx-5; + } + tempah=tempcx&0xFF; + SetReg1(Part4Port,0x17,tempah); + tempbh=tempbh|((tempcx&0xFF00)>>8); + tempah=tempbh; + SetReg1(Part4Port,0x15,tempah); + + tempcx=VBInfo; + tempbx=VGAHDE; + tempmodeflag=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(tempmodeflag&HalfDCLK){ + tempbx=tempbx>>1; + } + +/* ynlai begin */ + if(IF_DEF_HiVision==1) { + tempah=0xA0; + if(tempbx!=1024) { + tempah=0xC0; + if(tempbx!=1280) tempah=0; + } + } + else { + if(VBInfo&SetCRT2ToLCD){ + tempah=0; + if(tempbx>800){ + tempah=0x60; + } + }else{ + tempah=0x080; + } + } +/* ynlai end */ + if(LCDResInfo!=Panel1280x1024){ + tempah=tempah|0x0A; + } + + SetRegANDOR(Part4Port,0x0E,~0xEF,tempah); + + tempebx=VDE; + +/* ynlai begin */ + if(IF_DEF_HiVision==1) { + if(!(tempah&0xE0)) tempbx=tempbx>>1; + } +/* ynlai end */ + + tempcx=RVBHRS; + tempah=tempcx&0xFF; + SetReg1(Part4Port,0x18,tempah); + + tempeax=VGAVDE; + tempcx=tempcx|0x04000; + tempeax=tempeax-tempebx; + if(tempeax<0){ + tempcx=tempcx^(0x04000); + tempeax=VGAVDE; + } + + templong=(tempeax*256*1024)/tempebx; + if(tempeax*256*1024-templong*tempebx>0){ + tempebx=templong+1; + }else{ + tempebx=templong; + } + + + tempah=tempebx&0xFF; + SetReg1(Part4Port,0x1B,tempah); + tempah=(tempebx&0xFF00)>>8; + SetReg1(Part4Port,0x1A,tempah); + tempebx=tempebx>>16; + tempah=tempebx&0xFF; + tempah=(tempah<<4)&0xFF; + tempah=tempah|((tempcx&0xFF00)>>8); + SetReg1(Part4Port,0x19,tempah); + + SetCRT2VCLK(BaseAddr,ROMAddr,ModeNo); +} + +static void SetCRT2VCLK(UShort BaseAddr,ULong ROMAddr,UShort ModeNo) +{ + UShort vclk2ptr; + UShort tempah,temp1; + UShort Part4Port; + + Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; + vclk2ptr=GetVCLK2Ptr(ROMAddr,ModeNo); + SetReg1(Part4Port,0x0A,0x01); + tempah=*((UChar *)(ROMAddr+vclk2ptr+0x01)); /* di+1 */ + SetReg1(Part4Port,0x0B,tempah); + tempah=*((UChar *)(ROMAddr+vclk2ptr+0x00)); /* di */ + SetReg1(Part4Port,0x0A,tempah); + SetReg1(Part4Port,0x12,0x00); + tempah=0x08; + if(VBInfo&SetCRT2ToRAMDAC){ + tempah=tempah|0x020; + } + temp1=GetReg1(Part4Port,0x12); + tempah=tempah|temp1; + SetReg1(Part4Port,0x12,tempah); +} + +static void SetGroup5(UShort BaseAddr,ULong ROMAddr) +{ + UShort Part5Port; + UShort Pindex,Pdata; + Part5Port=BaseAddr+IND_SIS_CRT2_PORT_14+2; + Pindex=Part5Port; + Pdata=Part5Port+1; + if(ModeType==ModeVGA){ + if(!(VBInfo&(SetInSlaveMode|LoadDACFlag|CRT2DisplayFlag))){ + EnableCRT2(); + LoadDAC2(ROMAddr,Part5Port); + } + } + return; +} + +static void EnableCRT2(void) +{ + UShort temp1; + temp1=GetReg1(P3c4,0x1E); + temp1=temp1|0x20; + SetReg1(P3c4,0x1E,temp1); /* SR 1E */ +} + +static void LoadDAC2(ULong ROMAddr,UShort Part5Port) +{ + UShort data,data2; + UShort time,i,j,k; + UShort m,n,o; + UShort si,di,bx,dl; + UShort al,ah,dh; + UShort *table=0; + UShort Pindex,Pdata; + Pindex=Part5Port; + Pdata=Part5Port+1; + data=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); + data=data&DACInfoFlag; + time=64; + if(data==0x00) table=MDA_DAC; + if(data==0x08) table=CGA_DAC; + if(data==0x10) table=EGA_DAC; + if(data==0x18) { + time=256; + table=VGA_DAC; + } + if(time==256) j=16; + else j=time; + + SetReg3(Pindex,0x00); + + for(i=0;i<j;i++) { + data=table[i]; + for(k=0;k<3;k++) { + data2=0; + if(data&0x01) data2=0x2A; + if(data&0x02) data2=data2+0x15; + SetReg3(Pdata,data2); + data=data>>2; + } + } + + if(time==256) { + for(i=16;i<32;i++) { + data=table[i]; + for(k=0;k<3;k++) SetReg3(Pdata,data); + } + si=32; + for(m=0;m<9;m++) { + di=si; + bx=si+0x04; + dl=0; + for(n=0;n<3;n++) { + for(o=0;o<5;o++) { + dh=table[si]; + ah=table[di]; + al=table[bx]; + si++; + WriteDAC2(Pdata,dl,ah,al,dh); + } /* for 5 */ + si=si-2; + for(o=0;o<3;o++) { + dh=table[bx]; + ah=table[di]; + al=table[si]; + si--; + WriteDAC2(Pdata,dl,ah,al,dh); + } /* for 3 */ + dl++; + } /* for 3 */ + si=si+5; + } /* for 9 */ + } +} + +static void WriteDAC2(UShort Pdata,UShort dl, UShort ah, UShort al, UShort dh) +{ + UShort temp; + UShort bh,bl; + + bh=ah; + bl=al; + if(dl!=0) { + temp=bh; + bh=dh; + dh=temp; + if(dl==1) { + temp=bl; + bl=dh; + dh=temp; + } + else { + temp=bl; + bl=bh; + bh=temp; + } + } + SetReg3(Pdata,(UShort)dh); + SetReg3(Pdata,(UShort)bh); + SetReg3(Pdata,(UShort)bl); +} + +void LockCRT2(UShort BaseAddr) +{ + UShort Part1Port; + UShort Part4Port; + UShort temp1; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; + temp1=GetReg1(Part1Port,0x24); + temp1=temp1&0xFE; + SetReg1(Part1Port,0x24,temp1); +} + +static void SetLockRegs(void) +{ + UShort temp1; + + if((VBInfo&SetInSlaveMode)&&(!(VBInfo&SetCRT2ToRAMDAC))){ + VBLongWait(); + temp1=GetReg1(P3c4,0x32); + temp1=temp1|0x20; + SetReg1(P3c4,0x32,temp1); + VBLongWait(); + } +} + +void EnableBridge(UShort BaseAddr) +{ + UShort part2_02,part2_05; + UShort Part2Port; + Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; + + if(IF_DEF_LVDS==0) { + part2_02=(UChar)GetReg1(Part2Port,0x02); + part2_05=(UChar)GetReg1(Part2Port,0x05); + SetReg1(Part2Port,0x02,0x38); + SetReg1(Part2Port,0x05,0xFF); + LongWait(); + SetRegANDOR(Part2Port,0x00,~0x0E0,0x020); + /* WaitVBRetrace(BaseAddr); */ + SetReg1(Part2Port,0x02,part2_02); + SetReg1(Part2Port,0x05,part2_05); + } + else { + EnableCRT2(); + UnLockCRT2(BaseAddr); +/* SetRegANDOR(Part1Port,0x02,~0x040,0x0); */ + } +} + +static void GetVBInfo(UShort BaseAddr,ULong ROMAddr) +{ + UShort flag1,tempbx,tempbl,tempbh,tempah,temp; + + SetFlag=0; + tempbx=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + tempbl=tempbx&ModeInfoFlag; + ModeType=tempbl; + tempbx=0; + flag1=GetReg1(P3c4,0x38); /* call BridgeisOn */ + if(IF_DEF_LVDS==0) { /* for 301 */ + if(!(flag1&0x20)){ + VBInfo=CRT2DisplayFlag; + return; + } + } + tempbl=GetReg1(P3d4,0x30); + tempbh=GetReg1(P3d4,0x31); + + tempah=((SetCHTVOverScan>>8)|(SetInSlaveMode>>8)|(DisableCRT2Display>>8)); + tempah=tempah^0xFF; + tempbh=tempbh&tempah; +/* ynlai begin */ + if(IF_DEF_LVDS==1){ /* for LVDS */ + if(IF_DEF_CH7005==1) temp=SetCRT2ToLCD|SetCRT2ToTV; + else temp=SetCRT2ToLCD; + } + else { + if(IF_DEF_HiVision==1) temp=0xFC; + else temp=0x7C; + } + if(!(tempbl&temp)) { + VBInfo=DisableCRT2Display; + return; + } +/* ynlai end */ + if(IF_DEF_LVDS==0) { + if(tempbl&SetCRT2ToRAMDAC){ + tempbl=tempbl&(SetCRT2ToRAMDAC|SwitchToCRT2|SetSimuScanMode); + }else if(tempbl&SetCRT2ToLCD){ + tempbl=tempbl&(SetCRT2ToLCD|SwitchToCRT2|SetSimuScanMode); + }else if(tempbl&SetCRT2ToSCART){ + tempbl=tempbl&(SetCRT2ToSCART|SwitchToCRT2|SetSimuScanMode); + tempbh=tempbh|(SetPALTV>>8); + }else if(tempbl&SetCRT2ToHiVisionTV){ + tempbl=tempbl&(SetCRT2ToHiVisionTV|SwitchToCRT2|SetSimuScanMode); +/* ynlai begin */ + tempbh=tempbh|(SetPALTV>>8); +/* ynlai end */ + } + } + else { + if(IF_DEF_CH7005==1) { + if(tempbl&SetCRT2ToTV) + tempbl=tempbl&(SetCRT2ToTV|SwitchToCRT2|SetSimuScanMode); + } + if(tempbl&SetCRT2ToLCD) + tempbl=tempbl&(SetCRT2ToLCD|SwitchToCRT2|SetSimuScanMode); + } + tempah=GetReg1(P3d4,0x31); + if(tempah&(CRT2DisplayFlag>>8)){ + if(!(tempbl&(SwitchToCRT2|SetSimuScanMode))){ + tempbx=SetSimuScanMode|CRT2DisplayFlag; + tempbh=((tempbx&0xFF00)>>8); + tempbl=tempbx&0xFF; + } + } + if(!(tempbh&(DriverMode>>8))){ + tempbl=tempbl|SetSimuScanMode; + } + VBInfo=tempbl|(tempbh<<8); + if(!(VBInfo&SetSimuScanMode)){ + if(!(VBInfo&SwitchToCRT2)){ + if(BridgeIsEnable(BaseAddr)){ + if(BridgeInSlave()){ + VBInfo=VBInfo|SetSimuScanMode; + } + } + } + else { + flag1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(!(flag1&CRT2Mode)) { + VBInfo=VBInfo|SetSimuScanMode; + } + } + } + if(!(VBInfo&DisableCRT2Display)) { + if(VBInfo&DriverMode) { + if(VBInfo&SetSimuScanMode) { + flag1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(!(flag1&CRT2Mode)) { + VBInfo=VBInfo|SetInSlaveMode; + } + } + } + else { + VBInfo=VBInfo|SetSimuScanMode; + if(IF_DEF_LVDS==0) { + if(VBInfo&SetCRT2ToTV) { + if(!(VBInfo&SetNotSimuMode)) SetFlag=SetFlag|TVSimuMode; + } + } + } + } + if(IF_DEF_CH7005==1) { + tempah=GetReg1(P3d4,0x35); + if(tempah&TVOverScan) VBInfo=VBInfo|SetCHTVOverScan; + } +} + +static Bool BridgeIsEnable(UShort BaseAddr) +{ + UShort flag1; + UShort Part1Port; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + + if(IF_DEF_LVDS==1){ + return 1; + } + flag1=GetReg1(P3c4,0x38); /* call BridgeisOn */ + if(!(flag1&0x20)){ return 0;} + flag1=GetReg1(Part1Port,0x0); + if(flag1&0x0a0){ + return 1; + }else{ + return 0; + } +} + +static Bool BridgeInSlave(void) +{ + UShort flag1; + flag1=GetReg1(P3d4,0x31); + if(flag1&(SetInSlaveMode>>8)){ + return 1; + }else{ + return 0; + } +} + +static Bool GetLCDResInfo(ULong ROMAddr,UShort P3d4) +{ + UShort tempah,tempbh,tempflag; + + tempah=(UChar)GetReg1(P3d4,0x36); + tempbh=tempah; + tempah=tempah&0x0F; +/* if(tempah!=0) tempah--; */ + if(tempah>Panel1280x1024) tempah=0; + LCDResInfo=tempah; + tempbh=tempbh>>4; + LCDTypeInfo=tempbh; + + tempah=(UChar)GetReg1(P3d4,0x37); + LCDInfo=tempah; + + if(IF_DEF_LVDS==1){ + tempflag=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(tempflag&HalfDCLK){ + if(IF_DEF_TRUMPION==0){ + if(!(LCDInfo&LCDNonExpanding)){ + if(LCDResInfo==Panel1024x768){ + tempflag=*((UChar *)(ROMAddr+ModeIDOffset+0x09));/*si+Ext_ResInfo*/ + if(tempflag==4){ /*512x384 */ + SetFlag=SetFlag|EnableLVDSDDA; + } + }else{ + if(LCDResInfo==Panel800x600){ + tempflag=*((UChar*)(ROMAddr+ModeIDOffset+0x09));/*si+Ext_ResInfo*/ + if(tempflag==3){ /*400x300 */ + SetFlag=SetFlag|EnableLVDSDDA; + } + } + } + }else{ + SetFlag=SetFlag|EnableLVDSDDA; + } + }else{ + SetFlag=SetFlag|EnableLVDSDDA; + } + } + } + + if(!(VBInfo&SetCRT2ToLCD)){ + return 1; + } + if(!(VBInfo&(SetSimuScanMode|SwitchToCRT2))){ + return 1; + } + if(VBInfo&SetInSlaveMode){ + if(VBInfo&SetNotSimuMode){ + SetFlag=SetFlag|LCDVESATiming; + } + }else{ + SetFlag=SetFlag|LCDVESATiming; + } + return 1; +} + +static void PresetScratchregister(UShort P3d4) +{ + SetReg1(P3d4,0x37,0x00); +} + +static Bool GetLCDDDCInfo(ScrnInfoPtr pScrn) +{ + UShort tempah; +/*tempah=(HwDeviceExtension->usLCDType);// set in sisv.c */ + tempah=1; + SetReg1(P3d4,0x36,tempah); /* cr 36 0:no LCD 1:1024x768 2:1280x1024 */ + if(tempah>0) return 1; + else return 0; +} + +static void SetTVSystem(void) +{ + UShort tempah; + tempah=GetReg1(P3c4,0x38); /* SR 38 */ + tempah=tempah&0x01; /* get SR 38 D0 TV Type Selection */ + /* 0:NTSC 1:PAL */ + SetRegANDOR(P3d4,0x31,~0x01,tempah); /* set CR 31 D0= SR 38 D0 */ + return; +} + +static void LongWait(void) +{ + UShort i; + for(i=0; i<0xFFFF; i++) { + if(!(inSISREG(P3da) & 0x08)) + break; + } + for(i=0; i<0xFFFF; i++) { + if((inSISREG(P3da) & 0x09) == 9) + break; + } +} + +static void VBLongWait(void) +{ + UShort regsr1f,tempah,temp; + + regsr1f=GetReg1(P3c4,0x1F); + tempah=regsr1f&(~0xC0); + SetReg1(P3c4,0x1F,tempah); + + for(temp=1;temp>0;){ + temp=GetReg2(P3da); + temp=temp&0x08; + } + for(;temp==0;){ + temp=GetReg2(P3da); + temp=temp&0x08; + } + + SetReg1(P3c4,0x1F,regsr1f); + return; +} + +static Bool WaitVBRetrace(UShort BaseAddr) +{ + UShort temp; + UShort Part1Port; + Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; + temp=GetReg1(Part1Port,0x00); + if(!(temp&0x80)){ + return 0; + } + + for(temp=0;temp==0;){ + temp=GetReg1(Part1Port,0x25); + temp=temp&0x01; + } + for(;temp>0;){ + temp=GetReg1(Part1Port,0x25); + temp=temp&0x01; + } + return 1; +} + + +static void ModCRT1CRTC(ULong ROMAddr,UShort ModeNo) +{ + UShort OldREFIndex,temp,tempah,i,modeflag1; + + OldREFIndex=(UShort)REFIndex; + temp=GetLVDSCRT1Ptr(ROMAddr,ModeNo); + if(temp==0){ + REFIndex=OldREFIndex; + return; + } + tempah=(UChar)GetReg1(P3d4,0x11);/*unlock cr0-7 */ + tempah=tempah&0x7F; + SetReg1(P3d4,0x11,tempah); + tempah=*((UChar *)(ROMAddr+REFIndex)); + SetReg1(P3d4,0x0,tempah); + REFIndex++; + for(i=0x02;i<=0x05;REFIndex++,i++){ + tempah=*((UChar *)(ROMAddr+REFIndex)); + SetReg1(P3d4,i,tempah); + } + for(i=0x06;i<=0x07;REFIndex++,i++){ + tempah=*((UChar *)(ROMAddr+REFIndex)); + SetReg1(P3d4,i,tempah); + } + for(i=0x10;i<=0x11;REFIndex++,i++){ + tempah=*((UChar *)(ROMAddr+REFIndex)); + SetReg1(P3d4,i,tempah); + } + for(i=0x15;i<=0x16;REFIndex++,i++){ + tempah=*((UChar *)(ROMAddr+REFIndex)); + SetReg1(P3d4,i,tempah); + } + + for(i=0x0A;i<=0x0C;REFIndex++,i++){ + tempah=*((UChar *)(ROMAddr+REFIndex)); + SetReg1(P3c4,i,tempah); + } + tempah=*((UChar *)(ROMAddr+REFIndex)); + tempah=tempah&0x0E0; + SetReg1(P3c4,0x0E,tempah); + + tempah=*((UChar *)(ROMAddr+REFIndex)); + tempah=tempah&0x01; + tempah=tempah<<5; + modeflag1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(modeflag1&DoubleScanMode){ + tempah=tempah|0x080; + } + SetRegANDOR(P3d4,0x09,~0x020,tempah); + REFIndex=OldREFIndex; + return; +} + +static void SetCRT2ECLK(ULong ROMAddr, UShort ModeNo) +{ + UShort OldREFIndex,tempah,tempal; + UShort P3cc=P3c9+3; + + OldREFIndex=(UShort)REFIndex; + if(IF_DEF_TRUMPION==0){ /*no trumpion */ + tempal=GetReg2(P3cc); + tempal=tempal&0x0C; + REFIndex=GetVCLK2Ptr(ROMAddr,ModeNo); + }else{ /*trumpion */ + SetFlag=SetFlag&(~ProgrammingCRT2); + tempal=*((UChar *)(ROMAddr+REFIndex+0x03)); /*&di+Ext_CRTVCLK */ + tempal=tempal&0x03F; + if(tempal==0x02){ /*31.5MHz */ + REFIndex=REFIndex-Ext2StructSize; + } + REFIndex=GetVCLKPtr(ROMAddr,ModeNo); + SetFlag=SetFlag|ProgrammingCRT2; + } + tempal=0x02B; + if(!(VBInfo&SetInSlaveMode)){ + tempal=tempal+3; + } + SetReg1(P3c4,0x05,0x86); + tempah=*((UChar *)(ROMAddr+REFIndex)); + SetReg1(P3c4,tempal,tempah); + tempah=*((UChar *)(ROMAddr+REFIndex+1)); + tempal++; + SetReg1(P3c4,tempal,tempah); + tempal++; + SetReg1(P3c4,tempal,0x80); + REFIndex=OldREFIndex; + return; +} + +static UShort GetLVDSDesPtr(ULong ROMAddr,UShort ModeNo) +{ + UShort tempcl,tempbx,tempal,tempptr,LVDSDesPtrData; + UShort Flag; + + Flag=1; + tempbx=0; + if(IF_DEF_CH7005==1) { + if(!(VBInfo&SetCRT2ToLCD)) { + Flag=0; + tempbx=32; + if(VBInfo&SetPALTV) tempbx=tempbx+2; + if(VBInfo&SetCHTVOverScan) tempbx=tempbx+1; + } + } + tempcl=LVDSDesDataLen; + if(Flag) { + tempbx=LCDTypeInfo; + if(LCDInfo&LCDNonExpanding){ + tempbx=tempbx+16; + } + } + if(ModeNo<=0x13) tempal=*((UChar *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ + else tempal=*((UChar *)(ROMAddr+REFIndex+4)); /*di+Ext_CRT2CRTC */ + tempal=tempal&0x1F; + tempal=tempal*tempcl; + tempbx=tempbx<<1; + LVDSDesPtrData=*((UShort *)(ROMAddr+ADR_LVDSDesPtrData)); + tempptr=*((UShort *)(ROMAddr+LVDSDesPtrData+tempbx)); + tempptr=tempptr+tempal; + return(tempptr); + +} + +static Bool GetLVDSCRT1Ptr(ULong ROMAddr,UShort ModeNo) +{ + UShort tempal,tempbx,modeflag1; + UShort LVDSCRT1DataPtr,Flag; + + if(!(VBInfo&SetInSlaveMode)){ +/* return 0; */ + } + Flag=1; + tempbx=0; + if(IF_DEF_CH7005==1) { + if(!(VBInfo&SetCRT2ToLCD)) { + Flag=0; + tempbx=12; + if(VBInfo&SetPALTV) tempbx=tempbx+2; + if(VBInfo&SetCHTVOverScan) tempbx=tempbx+1; + } + } + if(Flag) { + tempbx=LCDResInfo; + tempbx=tempbx-Panel800x600; + if(LCDInfo&LCDNonExpanding) tempbx=tempbx+6; + modeflag1=*((UShort *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ + if(modeflag1&HalfDCLK) tempbx=tempbx+3; + } + if(ModeNo<=0x13) tempal=*((UChar *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ + else tempal=*((UChar *)(ROMAddr+REFIndex+4)); /*di+Ext_CRT2CRTC */ + tempal=tempal&0x3F; + + tempbx=tempbx<<1; + LVDSCRT1DataPtr=*((UShort *)(ROMAddr+ADR_LVDSCRT1DataPtr)); + REFIndex=*((UShort *)(ROMAddr+LVDSCRT1DataPtr+tempbx)); + tempal=tempal*LVDSCRT1Len; + REFIndex=REFIndex+tempal; + return 1; + +} + +static void SetCHTVReg(ULong ROMAddr,UShort ModeNo) +{ + UShort old_REFIndex,temp,tempbx,tempcl; + + old_REFIndex=(UShort)REFIndex; /*push di */ + GetCHTVRegPtr(ROMAddr,ModeNo); + + if(VBInfo&SetPALTV) { + SetCH7005(0x4304); + SetCH7005(0x6909); + } + else { + SetCH7005(0x0304); + SetCH7005(0x7109); + } + + temp=*((UShort *)(ROMAddr+REFIndex+0x00)); + tempbx=((temp&0x00FF)<<8)|0x00; + SetCH7005(tempbx); + temp=*((UShort *)(ROMAddr+REFIndex+0x01)); + tempbx=((temp&0x00FF)<<8)|0x07; + SetCH7005(tempbx); + temp=*((UShort *)(ROMAddr+REFIndex+0x02)); + tempbx=((temp&0x00FF)<<8)|0x08; + SetCH7005(tempbx); + temp=*((UShort *)(ROMAddr+REFIndex+0x03)); + tempbx=((temp&0x00FF)<<8)|0x0A; + SetCH7005(tempbx); + temp=*((UShort *)(ROMAddr+REFIndex+0x04)); + tempbx=((temp&0x00FF)<<8)|0x0B; + SetCH7005(tempbx); + + SetCH7005(0x2801); + SetCH7005(0x3103); + SetCH7005(0x003D); + SetCHTVRegANDOR(0x0010,0x1F); + SetCHTVRegANDOR(0x0211,0xF8); + SetCHTVRegANDOR(0x001C,0xEF); + + if(!(VBInfo&SetPALTV)) { + if(ModeNo<=0x13) tempcl=*((UChar *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ + else tempcl=*((UChar *)(ROMAddr+REFIndex+4)); /* di+Ext_CRT2CRTC */ + tempcl=tempcl&0x3F; + if(VBInfo&SetCHTVOverScan) { + if(tempcl==0x04) { /* 640x480 underscan */ + SetCHTVRegANDOR(0x0020,0xEF); + SetCHTVRegANDOR(0x0121,0xFE); + } + else { + if(tempcl==0x05) { /* 800x600 underscan */ + SetCHTVRegANDOR(0x0118,0xF0); + SetCHTVRegANDOR(0x0C19,0xF0); + SetCHTVRegANDOR(0x001A,0xF0); + SetCHTVRegANDOR(0x001B,0xF0); + SetCHTVRegANDOR(0x001C,0xF0); + SetCHTVRegANDOR(0x001D,0xF0); + SetCHTVRegANDOR(0x001E,0xF0); + SetCHTVRegANDOR(0x001F,0xF0); + SetCHTVRegANDOR(0x0120,0xEF); + SetCHTVRegANDOR(0x0021,0xFE); + } + } + } + else { + if(tempcl==0x04) { /* 640x480 overscan */ + SetCHTVRegANDOR(0x0020,0xEF); + SetCHTVRegANDOR(0x0121,0xFE); + } + else { + if(tempcl==0x05) { /* 800x600 overscan */ + SetCHTVRegANDOR(0x0118,0xF0); + SetCHTVRegANDOR(0x0F19,0xF0); + SetCHTVRegANDOR(0x011A,0xF0); + SetCHTVRegANDOR(0x0C1B,0xF0); + SetCHTVRegANDOR(0x071C,0xF0); + SetCHTVRegANDOR(0x011D,0xF0); + SetCHTVRegANDOR(0x0C1E,0xF0); + SetCHTVRegANDOR(0x071F,0xF0); + SetCHTVRegANDOR(0x0120,0xEF); + SetCHTVRegANDOR(0x0021,0xFE); + } + } + } + } + + REFIndex=old_REFIndex; +} + +static void SetCHTVRegANDOR(UShort tempax,UShort tempbh) +{ + UShort tempal,tempah,tempbl; + + tempal=tempax&0x00FF; + tempah=(tempax>>8)&0x00FF; + tempbl=GetCH7005(tempal); + tempbl=(((tempbl&tempbh)|tempah)<<8|tempal); + SetCH7005(tempbl); +} + +static void GetCHTVRegPtr(ULong ROMAddr,UShort ModeNo) +{ + UShort tempbx,tempal,tempcl,CHTVRegDataPtr; + + if(VBInfo&SetCRT2ToTV) { + tempbx=0; + if(VBInfo&SetPALTV) tempbx=tempbx+2; + if(VBInfo&SetCHTVOverScan) tempbx=tempbx+1; + + if(ModeNo<=0x13) tempal=*((UChar *)(ROMAddr+ModeIDOffset+0x04)); /* si+St_CRT2CRTC */ + else tempal=*((UChar *)(ROMAddr+REFIndex+4)); /* di+Ext_CRT2CRTC */ + tempal=tempal&0x3F; + + tempcl=CHTVRegDataLen; + tempal=tempal*tempcl; + tempbx=tempbx<<1; + + CHTVRegDataPtr=*((UShort *)(ROMAddr+ADR_CHTVRegDataPtr)); + REFIndex=*((UShort *)(ROMAddr+CHTVRegDataPtr+tempbx)); + REFIndex=REFIndex+tempal; + } +} + +void SetCH7005(UShort tempbx) +{ + UShort tempah,temp; + + DDC_Port=0x3c4; + DDC_Index=0x11; + DDC_DataShift=0x00; + DDC_DeviceAddr=0xEA; + + SetSwitchDDC2(); + SetStart(); + tempah=DDC_DeviceAddr; + temp=WriteDDC2Data(tempah); + tempah=tempbx&0x00FF; + temp=WriteDDC2Data(tempah); + tempah=(tempbx&0xFF00)>>8; + temp=WriteDDC2Data(tempah); + SetStop(); +} + +UShort GetCH7005(UShort tempbx) +{ + UShort tempah; + + DDC_Port=0x3c4; + DDC_Index=0x11; + DDC_DataShift=0x00; + DDC_DeviceAddr=0xEA; + DDC_ReadAddr=tempbx; + + SetSwitchDDC2(); + SetStart(); + tempah=DDC_DeviceAddr; + WriteDDC2Data(tempah); + tempah=DDC_ReadAddr; + WriteDDC2Data(tempah); + + SetStart(); + tempah=DDC_DeviceAddr; + tempah=tempah|0x01; + if(WriteDDC2Data(tempah)) { + } + tempah=ReadDDC2Data(tempah); + SetStop(); + return(tempah); +} + +static void SetSwitchDDC2(void) +{ + UShort i; + + SetSCLKHigh(); + for(i=0;i<1000;i++) { + GetReg1(DDC_Port,0x05); + } + SetSCLKLow(); + for(i=0;i<1000;i++) { + GetReg1(DDC_Port,0x05); + } +} + + +static void SetStart(void) +{ + SetSCLKLow(); + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); /* SetSDA(0x01); */ + SetSCLKHigh(); + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x00); /* SetSDA(0x00); */ + SetSCLKHigh(); +} + +static void SetStop(void) +{ + SetSCLKLow(); + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x00); /* SetSDA(0x00); */ + SetSCLKHigh(); + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); /* SetSDA(0x01); */ + SetSCLKHigh(); +} + +static UShort WriteDDC2Data(UShort tempax) +{ + UShort i,flag; + + flag=0x80; + for(i=0;i<8;i++) { + SetSCLKLow(); + if(tempax&flag) { + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); + } + else { + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x00); + } + SetSCLKHigh(); + flag=flag>>1; + } + return(CheckACK()); +} + +static UShort ReadDDC2Data(UShort tempax) +{ + UShort i,temp,getdata; + + getdata=0; + for(i=0;i<8;i++) { + getdata=getdata<<1; + SetSCLKLow(); + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); + SetSCLKHigh(); + temp=GetReg1(DDC_Port,DDC_Index); + if(temp&0x02) getdata=getdata|0x01; + } + return(getdata); +} + +static void SetSCLKLow(void) +{ + SetRegANDOR(DDC_Port,DDC_Index,0xFE,0x00); /* SetSCLKLow() */ + DDC2Delay(); +} + + +static void SetSCLKHigh(void) +{ + UShort temp; + + SetRegANDOR(DDC_Port,DDC_Index,0xFE,0x01); /* SetSCLKLow() */ + do { + temp=GetReg1(DDC_Port,DDC_Index); + } while(!(temp&0x01)); + DDC2Delay(); +} + +static void DDC2Delay(void) +{ + UShort i; + + for(i=0;i<DDC2DelayTime;i++) { + GetReg1(P3c4,0x05); + } +} + +static UShort CheckACK(void) +{ + UShort tempah; + + SetSCLKLow(); + SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); + SetSCLKHigh(); + tempah=GetReg1(DDC_Port,DDC_Index); + SetSCLKLow(); + if(tempah&0x01) return(1); + else return(0); } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h index cc21f62fe..91ab62d2b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h @@ -1,199 +1,208 @@ -#define P1_INDEX 0x04 -#define P2_INDEX 0x10 -#define P3_INDEX 0x12 -#define P4_INDEX 0x14 -#define P5_INDEX 0x16 - -/* CR30 VBInfo = CR31:CR30 */ -#define SET_SIMU_SCAN_MODE 0x0001 -#define SWITCH_TO_CRT2 0x0002 -#define SET_CRT2_TO_AVIDEO 0x0004 /* Composite */ -#define SET_CRT2_TO_SVIDEO 0x0008 -#define SET_CRT2_TO_SCART 0x0010 -#define SET_CRT2_TO_LCD 0x0020 -#define SET_CRT2_TO_RAMDAC 0x0040 -#define SET_CRT2_TO_HIVISION_TV 0x0080 -#define SET_CRT2_TO_TV (SET_CRT2_TO_AVIDEO | SET_CRT2_TO_SVIDEO | \ - SET_CRT2_TO_SCART | SET_CRT2_TO_HIVISION_TV) -/* CR31 */ -#define SET_PAL_TV 0x0100 -#define SET_IN_SLAVE_MODE 0x0200 -#define SET_NO_SIMU_ON_LOCK 0x0400 -#define SET_NO_SIMU_TV_ON_LOCK SET_NO_SIMU_ON_LOCK -#define DISABLE_LOAD_CRT2DAC 0x1000 -#define DISABLE_CRT2_DISPLAY 0x2000 -#define DRIVER_MODE 0x4000 - -/* CR36 */ -#define PANEL_1024x768 0x00 -#define PANEL_1280x1024 0x01 - -/* Set Flag */ -#define PROGRAMMING_CRT2 0x0001 -#define TV_SIMU_MODE 0x0002 -#define RPLLDIV2XO 0x0004 - -/* Mode Flag */ -#define MODE_INFO_FLAG 0x0007 -#define MODE_CGA 0x0001 -#define MODE_EGA 0x0002 -#define MODE_VGA 0x0003 -#define MODE_15BPP 0x0004 -#define MODE_16BPP 0x0005 -#define MODE_24BPP 0x0006 -#define MODE_32BPP 0x0007 - -#define DAC_INFO_FLAG 0x0018 -#define MONO_DAC 0x0000 -#define CGA_DAC 0x0008 -#define EGA_DAC 0x0010 -#define VGA_DAC 0x0018 - -#define CHAR_8DOT 0x0200 -#define LINE_COMPARE_OFF 0x0400 -#define CRT2_MODE 0x0800 -#define HALF_DCLK 0x1000 -#define NO_SUPPORT_SIMU_TV 0x2000 -#define AFTER_LOCK_CRT2 0x4000 -#define DOUBLE_SCAN 0x8000 - -/* LCD Res Info */ -#define LCDVESA_TIMING 0x08 - -/* LCD Type Info */ -/* LCD Info */ -#define LCDRGB18BIT 0x01 - -/* Misc definition */ -#define SELECT_CRT1 0x01 -#define SELECT_CRT2 0x02 - -#define MODE_INFO_MASK 0x0007 -#define AFTER_LOCK_CRT2 0x4000 - -#define SUPPORT_TV 0x0008 -#define SUPPORT_LCD 0x0020 -#define SUPPORT_RAMDAC2 0x0040 - -/* GetRatePtr */ -#define STANDARD_MODE 0x0000 -#define ENHANCED_MODE 0x0001 -#define CRT2_SUPPORT 0x0002 -#define CRT2_NO_SUPPORT 0x0000 - -#define INTERLACE_MODE 0x0080 - -/* VCLK index */ -#define VCLK65 0x09 -#define VCLK108_2 0x14 - -/* TV resolution info */ -#define ST_HIVISION_TV_HT 892 -#define ST_HIVISION_TV_VT 1126 -#define EXT_HIVISION_TV_HT 2100 -#define EXT_HIVISION_TV_VT 1125 -#define PAL_HT 1728 -#define PAL_VT 625 -#define NTSC_HT 1716 -#define NTSC_VT 525 - -#define TVVCLKDIV2 0x21 -#define TVVCLK 0x22 -#define HITVVCLKDIV2 0x23 -#define HITVVCLK 0x24 -#define HITVSIMUVCLK 0x25 - -#define LCDDATA(p0,p1,p2,p3,p4,p5) {p0&0xFF, p1&0xFF, p2&0xFF,\ - (p2>>8)|((p3&0xF)<<4), (p3>>4)|((p0&0x100)>>1), p4&0xFF,\ - (p4>>8)|((p5&0xF)<<4), p5>>4} -#define TVDATA(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12) {p0&0xFF,\ - p1&0xFF, p2&0xFF, (p2>>8)|((p3&0xF)<<4),\ - (p3>>4)|((p0&0x100)>>1), p4&0xFF, (p4>>8)|((p5&0xF)<<4),\ - p5>>4, p6&0xFF, (p6>>8)|(p7<<7), p8&0xFF, p8>>8, p9&0xFF,\ - p10&0xFF, p11&0xFF, p12&0xFF} -#define HITVDATA(p0,p1,p2,p3,p4,p5,p6,p7,p8) {p0&0xFF, p1&0xFF, p2&0xFF,\ - (p2>>8)|((p3&0xF)<<4), (p3>>4)|((p0&0x100)>>1), p4&0xFF,\ - (p4>>8)|((p5&0xF)<<4), p5>>4, p6&0xFF, (p6>>8)|(p7<<7),\ - p8&0xFF, p8>>8} - -#define STMODE_SIZE 6 -#define EMODE_SIZE 10 -#define EMODE2_SIZE 5 - -typedef struct _STMode { - unsigned char ModeID; - unsigned short ModeFlag; - unsigned char StModeTableIndex; - unsigned char CRTC2Index; - unsigned char ResInfo; -} STModeRec, *STModePtr; - -typedef struct _EMode { - unsigned char ModeID; - unsigned short ModeFlag; - unsigned char ModeInfo; - unsigned short EMode2Offset; - unsigned short VESAModeID; - unsigned char MemSize; - unsigned char ResInfo; -} EModeRec, *EModePtr; - -typedef struct _EMode2 { - unsigned short InfoFlag; - unsigned char CRTC1Index; - unsigned char VCLKIndex; - unsigned char CRTC2Index; -} EMode2Rec, *EMode2Ptr; - -typedef struct _CRTCInfoBlock { - unsigned short HTotal; - unsigned short HSyncStart; - unsigned short HSyncEnd; - unsigned short VTotal; - unsigned short VSyncStart; - unsigned short VSyncEnd; - unsigned char Flag; - unsigned long PixelClock; - unsigned short RefreshRate; -} CRTCInfo, *CRTCInfoPtr; - -Bool SiSSetMode(ScrnInfoPtr pScrn, CARD16 ModeNo); -Bool SearchModeID(CARD8 *ROMAddr, CARD16 ModeNo); -void GetVBInfo(CARD16 BaseAddr, CARD8 *ROMAddr); -Bool BridgeIsOn(CARD16 BaseAddr); -Bool BridgeIsEnable(CARD16 BaseAddr); -Bool BridgeInSlave(CARD16 BaseAddr); -void GetLCDResInfo(CARD16 p3d4); -Bool CheckVBInfo(CARD16 BaseAddr); -CARD16 GetRatePtr(ScrnInfoPtr pScrn, CARD16 ModeNo, CARD8 CRTx); -CARD16 AdjustCRT2Rate(CARD8 *ROMAddr); -void SaveCRT2Info(CARD16 p3d4, CARD16 ModeNo); -void SetCRT2Group(ScrnInfoPtr pScrn, CARD16 ModeNo); -void LongWait(CARD16 p3da); -void VBLongWait(CARD16 p3da); -Bool WaitVBRetrace(CARD16 BaseAddr); -void EnableBridge(CARD16 BaseAddr); -void DisableBridge(CARD16 BaseAddr); -void LockCRT2(CARD16 BaseAddr); -void UnLockCRT2(CARD16 BaseAddr); -void EnableCRT2(CARD16 BaseAddr); -void SetCRT2ModeRegs(CARD16 BaseAddr, CARD16 ModeNo); -void GetResInfo(CARD8 *ROMAddr, CARD16 ModeNo); -Bool GetLockInfo(CARD16 p3d4, CARD8 info); -void SetLockRegs(CARD16 BaseAddr, CARD8 info); -void GetCRT1Ptr(CARD8 *ROMAddr); -void GetCRT2Ptr(CARD8 *ROMAddr, CARD16 ModeNo); -void GetRAMDAC2Data(CARD8 *ROMAddr, CARD16 ModeNo); -void GetCRT2Data(CARD8 *ROMAddr, CARD16 ModeNo); -void SetCRT2Offset(ScrnInfoPtr pScrn); -void SetCRT2FIFO(ScrnInfoPtr pScrn); -void SetCRT2Sync(CARD8 *ROMAddr, CARD16 part1_base); -void SetGroup1(ScrnInfoPtr pScrn, CARD16 ModeNo); -void SetGroup2(CARD16 BaseAddr, CARD8 *ROMAddr); -void SetGroup3(CARD16 BaseAddr); -void SetGroup4(CARD16 BaseAddr, CARD8 *ROMAddr, CARD16 ModeNo); -void SetGroup5(CARD16 BaseAddr, CARD8 *ROMAddr); -void SetBlock(CARD16 port, CARD8 from, CARD8 to, CARD8 *DataPtr); -CARD16 GetVGAHT2(void); -void SetCRT2VCLK(CARD16 BaseAddr, CARD8 *ROMAddr, CARD16 ModeNo); -CARD8 * GetVCLK2Ptr(CARD16 BaseAddr, CARD8 *ROMAddr, CARD16 ModeNo); +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h,v 1.4 2001/04/19 14:11:37 alanh Exp $ */ + +typedef unsigned long ULong; +typedef unsigned short UShort; +typedef unsigned char UChar; + +#define Bool Bool + +#define CRT1Len 17 +#define LVDSCRT1Len 15 +#define CHTVRegDataLen 5 + +#define ModeInfoFlag 0x07 +#define IsTextMode 0x07 +#define ModeText 0x00 +#define ModeCGA 0x01 +#define ModeEGA 0x02 +#define ModeVGA 0x03 +#define Mode15Bpp 0x04 +#define Mode16Bpp 0x05 +#define Mode24Bpp 0x06 +#define Mode32Bpp 0x07 + +#define DACInfoFlag 0x18 +#define MemoryInfoFlag 0x1E0 +#define MemorySizeShift 0x05 + +#define Charx8Dot 0x0200 +#define LineCompareOff 0x0400 +#define CRT2Mode 0x0800 +#define HalfDCLK 0x1000 +#define NoSupportSimuTV 0x2000 +#define DoubleScanMode 0x8000 + +#define SupportAllCRT2 0x0078 +#define SupportTV 0x0008 +#define SupportHiVisionTV 0x0010 +#define SupportLCD 0x0020 +#define SupportRAMDAC2 0x0040 +#define NoSupportTV 0x0070 +#define NoSupportHiVisionTV 0x0060 +#define NoSupportLCD 0x0058 +#define SupportCHTV 0x0800 +#define InterlaceMode 0x0080 +#define SyncPP 0x0000 +#define SyncPN 0x4000 +#define SyncNP 0x8000 +#define SyncNN 0xc000 +#define ECLKindex0 0x0000 +#define ECLKindex1 0x0100 +#define ECLKindex2 0x0200 +#define ECLKindex3 0x0300 +#define ECLKindex4 0x0400 + +#define SetSimuScanMode 0x0001 +#define SwitchToCRT2 0x0002 +#define SetCRT2ToTV 0x009C +#define SetCRT2ToAVIDEO 0x0004 +#define SetCRT2ToSVIDEO 0x0008 +#define SetCRT2ToSCART 0x0010 +#define SetCRT2ToLCD 0x0020 +#define SetCRT2ToRAMDAC 0x0040 +#define SetCRT2ToHiVisionTV 0x0080 +#define SetNTSCTV 0x0000 +#define SetPALTV 0x0100 +#define SetInSlaveMode 0x0200 +#define SetNotSimuMode 0x0400 +#define SetDispDevSwitch 0x0800 +#define LoadDACFlag 0x1000 +#define DisableCRT2Display 0x2000 +#define DriverMode 0x4000 +#define HotKeySwitch 0x8000 +#define SetCHTVOverScan 0x8000 + +#define TVOverScan 0x10 +#define TVOverScanShift 4 +#define ClearBufferFlag 0x20 + +#define SetSCARTOutput 0x01 +#define BoardTVType 0x02 + +#define ProgrammingCRT2 0x01 +#define TVSimuMode 0x02 +#define RPLLDIV2XO 0x04 +#define LCDVESATiming 0x08 +#define EnableLVDSDDA 0x10 +#define SetDispDevSwitchFlag 0x20 +#define CheckWinDos 0x40 +#define SetJDOSMode 0x80 + +#define Panel800x600 0x01 +#define Panel1024x768 0x02 +#define Panel1280x1024 0x03 +#define Panel1280x960 0x04 +#define Panel640x480 0x05 +#define LCDRGB18Bit 0x01 +#define ExtChipType 0x0e +#define ExtChip301 0x02 +#define ExtChipLVDS 0x04 +#define ExtChipTrumpion 0x06 +#define ExtChipCH7005 0x08 +#define ExtChipMitacTV 0x0a +#define LCDNonExpanding 0x10 +#define LCDNonExpandingShift 4 +#define LCDSync 0x20 +#define LCDSyncBit 0xe0 +#define LCDSyncshift 6 + +#define DDC2DelayTime 10 + +#define CRT2DisplayFlag 0x2000 +#define LCDDataLen 8 +#define HiTVDataLen 12 +#define TVDataLen 16 +#define SetPALTV 0x0100 +#define HalfDCLK 0x1000 +#define NTSCHT 1716 +#define NTSCVT 525 +#define PALHT 1728 +#define PALVT 625 +#define StHiTVHT 892 +#define StHiTVVT 1126 +#define StHiTextTVHT 1000 +#define StHiTextTVVT 1126 +#define ExtHiTVHT 2100 +#define ExtHiTVVT 1125 + +#define SelectCRT2Rate 0x4 +#define VCLKStartFreq 25 +#define SoftDramType 0x80 +#define VCLK40 0x04 +#define VCLK65 0x09 +#define VCLK108_2 0x14 +#define LCDRGB18Bit 0x01 +#define LoadDACFlag 0x1000 +#define AfterLockCRT2 0x4000 +#define SetCRT2ToAVIDEO 0x0004 +#define SetCRT2ToSCART 0x0010 +#define Ext2StructSize 5 +#define TVVCLKDIV2 0x021 +#define TVVCLK 0x022 +#define HiTVVCLKDIV2 0x023 +#define HiTVVCLK 0x024 +#define HiTVSimuVCLK 0x025 +#define HiTVTextVCLK 0x026 +#define SwitchToCRT2 0x0002 +#define LCDVESATiming 0x08 +#define SetSCARTOutput 0x01 +#define SCARTSense 0x04 +#define Monitor1Sense 0x20 +#define Monitor2Sense 0x10 +#define SVIDEOSense 0x02 +#define AVIDEOSense 0x01 +#define LCDSense 0x08 +#define BoardTVType 0x02 +#define HotPlugFunction 0x08 +#define StStructSize 0x06 + +#define IND_SIS_CRT2_PORT_04 0x04 - 0x030 +#define IND_SIS_CRT2_PORT_10 0x10 - 0x30 +#define IND_SIS_CRT2_PORT_12 0x12 - 0x30 +#define IND_SIS_CRT2_PORT_14 0x14 - 0x30 + +#define IF_DEF_TRUMPION 0 +#define LCDNonExpanding 0x10 +#define ADR_CRT2PtrData 0x20E +#define offset_Zurac 0x210 +#define ADR_LVDSDesPtrData 0x212 +#define ADR_LVDSCRT1DataPtr 0x214 +#define ADR_CHTVVCLKPtr 0x216 +#define ADR_CHTVRegDataPtr 0x218 + +#define LVDSDataLen 6 +#define EnableLVDSDDA 0x10 +#define LVDSDesDataLen 3 +#define ActiveNonExpanding 0x40 +#define ActiveNonExpandingShift 6 +#define ModeSwitchStatus 0x0F +#define SoftTVType 0x40 + +#define SelectCRT1Rate 0x4 +#define SelectCRT2Rate 0x4 + +#define PanelType00 0x00 +#define PanelType01 0x08 +#define PanelType02 0x10 +#define PanelType03 0x18 +#define PanelType04 0x20 +#define PanelType05 0x28 +#define PanelType06 0x30 +#define PanelType07 0x38 +#define PanelType08 0x40 +#define PanelType09 0x48 +#define PanelType0A 0x50 +#define PanelType0B 0x58 +#define PanelType0C 0x60 +#define PanelType0D 0x68 +#define PanelType0E 0x70 +#define PanelType0F 0x78 + +Bool SiSSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode); +void SetReg1(UShort port, UShort index, UShort data); +void DisableBridge(UShort BaseAddr); +void UnLockCRT2(UShort BaseAddr); +void LockCRT2(UShort BaseAddr); +void EnableBridge(UShort BaseAddr); +void SetCH7005(UShort tempbx); +UShort GetCH7005(UShort tempbx); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c index 687a14086..62a6f0c75 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c @@ -7,7 +7,7 @@ * 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 + * 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. * @@ -20,12 +20,12 @@ * PERFORMANCE OF THIS SOFTWARE. * * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk - * Mike Chapman <mike@paranoia.com>, - * Juanjo Santamarta <santamarta@ctv.es>, - * Mitani Hiroshi <hmitani@drl.mei.co.jp> - * David Thomas <davtom@dream.org.uk>. + * Mike Chapman <mike@paranoia.com>, + * Juanjo Santamarta <santamarta@ctv.es>, + * Mitani Hiroshi <hmitani@drl.mei.co.jp> + * David Thomas <davtom@dream.org.uk>. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c,v 1.3 2000/03/31 20:13:36 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c,v 1.4 2001/04/19 12:40:33 alanh Exp $ */ #include "xf86.h" #include "xf86PciInfo.h" @@ -36,6 +36,8 @@ #include "sis_cursor.h" +Bool SiSHWCursorInit(ScreenPtr pScreen); + static void SiSShowCursor(ScrnInfoPtr pScrn) { @@ -50,12 +52,12 @@ SiSShowCursor(ScrnInfoPtr pScrn) static void SiS300ShowCursor(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - sis300EnableHWCursor() - if (pSiS->VBFlags & CRT2_ENABLE) { - sis301EnableHWCursor(); - } + sis300EnableHWCursor() + if (pSiS->VBFlags & CRT2_ENABLE) { + sis301EnableHWCursor(); + } } static void @@ -72,132 +74,132 @@ SiSHideCursor(ScrnInfoPtr pScrn) static void SiS300HideCursor(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - sis300DisableHWCursor() - if (pSiS->VBFlags & CRT2_ENABLE) { - sis301DisableHWCursor() - } + sis300DisableHWCursor() + if (pSiS->VBFlags & CRT2_ENABLE) { + sis301DisableHWCursor() + } } static void SiSSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) { - unsigned char x_preset = 0; - unsigned char y_preset = 0; - int temp; - - outw(VGA_SEQ_INDEX, 0x8605); /* Unlock Registers */ - - if (x < 0) { - x_preset = (-x); - x = 0; - } - if (y < 0) { - y_preset = (-y); - y = 0; - } - outw(VGA_SEQ_INDEX, (x&0xFF)<<8 | 0x1A); - outw(VGA_SEQ_INDEX, (x&0xFF00) | 0x1B); - outw(VGA_SEQ_INDEX, (y&0xFF)<<8 | 0x1D); - outb(VGA_SEQ_INDEX, 0x1E); - temp = inb(VGA_SEQ_DATA) & 0xF8; - outw(VGA_SEQ_INDEX, ((y&0x0700) | (temp<<8)) | 0x1E); - outw(VGA_SEQ_INDEX, x_preset<<8 | 0x1C); - outw(VGA_SEQ_INDEX, y_preset<<8 | 0x1F); + unsigned char x_preset = 0; + unsigned char y_preset = 0; + int temp; + + outw(VGA_SEQ_INDEX, 0x8605); /* Unlock Registers */ + + if (x < 0) { + x_preset = (-x); + x = 0; + } + if (y < 0) { + y_preset = (-y); + y = 0; + } + outw(VGA_SEQ_INDEX, (x&0xFF)<<8 | 0x1A); + outw(VGA_SEQ_INDEX, (x&0xFF00) | 0x1B); + outw(VGA_SEQ_INDEX, (y&0xFF)<<8 | 0x1D); + outb(VGA_SEQ_INDEX, 0x1E); + temp = inb(VGA_SEQ_DATA) & 0xF8; + outw(VGA_SEQ_INDEX, ((y&0x0700) | (temp<<8)) | 0x1E); + outw(VGA_SEQ_INDEX, x_preset<<8 | 0x1C); + outw(VGA_SEQ_INDEX, y_preset<<8 | 0x1F); } static void SiS300SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) { - SISPtr pSiS = SISPTR(pScrn); - - unsigned char x_preset = 0; - unsigned char y_preset = 0; - - if (x < 0) { - x_preset = (-x); - x = 0; - } - if (y < 0) { - y_preset = (-y); - y = 0; - } - sis300SetCursorPositionX(x, x_preset) - sis300SetCursorPositionY(y, y_preset) - if (pSiS->VBFlags & CRT2_ENABLE) { - sis301SetCursorPositionX(x+13, x_preset) - sis301SetCursorPositionY(y, y_preset) - } + SISPtr pSiS = SISPTR(pScrn); + + unsigned char x_preset = 0; + unsigned char y_preset = 0; + + if (x < 0) { + x_preset = (-x); + x = 0; + } + if (y < 0) { + y_preset = (-y); + y = 0; + } + sis300SetCursorPositionX(x, x_preset) + sis300SetCursorPositionY(y, y_preset) + if (pSiS->VBFlags & CRT2_ENABLE) { + sis301SetCursorPositionX(x+13, x_preset) + sis301SetCursorPositionY(y, y_preset) + } } static void SiSSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { - unsigned char f_red, f_green, f_blue; - unsigned char b_red, b_green, b_blue; - - outw(VGA_SEQ_INDEX, 0x8605); - - f_red = (fg & 0x00FF0000) >> (16+2); - f_green = (fg & 0x0000FF00) >> (8+2); - f_blue = (fg & 0x000000FF) >> 2; - b_red = (bg & 0x00FF0000) >> (16+2); - b_green = (bg & 0x0000FF00) >> (8+2); - b_blue = (bg & 0x000000FF) >> 2; - - outw(VGA_SEQ_INDEX, b_red <<8 | 0x14); - outw(VGA_SEQ_INDEX, b_green <<8 | 0x15); - outw(VGA_SEQ_INDEX, b_blue <<8 | 0x16); - outw(VGA_SEQ_INDEX, f_red <<8 | 0x17); - outw(VGA_SEQ_INDEX, f_green <<8 | 0x18); - outw(VGA_SEQ_INDEX, f_blue <<8 | 0x19); + unsigned char f_red, f_green, f_blue; + unsigned char b_red, b_green, b_blue; + + outw(VGA_SEQ_INDEX, 0x8605); + + f_red = (fg & 0x00FF0000) >> (16+2); + f_green = (fg & 0x0000FF00) >> (8+2); + f_blue = (fg & 0x000000FF) >> 2; + b_red = (bg & 0x00FF0000) >> (16+2); + b_green = (bg & 0x0000FF00) >> (8+2); + b_blue = (bg & 0x000000FF) >> 2; + + outw(VGA_SEQ_INDEX, b_red <<8 | 0x14); + outw(VGA_SEQ_INDEX, b_green <<8 | 0x15); + outw(VGA_SEQ_INDEX, b_blue <<8 | 0x16); + outw(VGA_SEQ_INDEX, f_red <<8 | 0x17); + outw(VGA_SEQ_INDEX, f_green <<8 | 0x18); + outw(VGA_SEQ_INDEX, f_blue <<8 | 0x19); } static void SiS300SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { - SISPtr pSiS = SISPTR(pScrn); - - sis300SetCursorBGColor(bg) - sis300SetCursorFGColor(fg) - if (pSiS->VBFlags & CRT2_ENABLE) { - sis301SetCursorBGColor(bg) - sis301SetCursorFGColor(fg) - } + SISPtr pSiS = SISPTR(pScrn); + + sis300SetCursorBGColor(bg) + sis300SetCursorFGColor(fg) + if (pSiS->VBFlags & CRT2_ENABLE) { + sis301SetCursorBGColor(bg) + sis301SetCursorFGColor(fg) + } } static void SiSLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) { - SISPtr pSiS = SISPTR(pScrn); - int cursor_addr; - unsigned char temp; + SISPtr pSiS = SISPTR(pScrn); + int cursor_addr; + unsigned char temp; - outw(VGA_SEQ_INDEX, 0x8605); + outw(VGA_SEQ_INDEX, 0x8605); - cursor_addr = pScrn->videoRam - 1; - memcpy((unsigned char *)pSiS->FbBase + cursor_addr * 1024, src, 1024); + cursor_addr = pScrn->videoRam - 1; + memcpy((unsigned char *)pSiS->FbBase + cursor_addr * 1024, src, 1024); - /* copy bits [21:18] into the top bits of SR38 */ - outb(VGA_SEQ_INDEX, 0x38); - temp = inb(VGA_SEQ_DATA) & 0x0F; - outb(VGA_SEQ_DATA, temp | ((cursor_addr & 0xF00) >> 4)); + /* copy bits [21:18] into the top bits of SR38 */ + outb(VGA_SEQ_INDEX, 0x38); + temp = inb(VGA_SEQ_DATA) & 0x0F; + outb(VGA_SEQ_DATA, temp | ((cursor_addr & 0xF00) >> 4)); - /* if set, store the bit [22] to SR3E */ - if (cursor_addr & 0x1000) { - outb(VGA_SEQ_INDEX, 0x3E); + /* if set, store the bit [22] to SR3E */ + if (cursor_addr & 0x1000) { + outb(VGA_SEQ_INDEX, 0x3E); temp = inb(VGA_SEQ_DATA) | 0x04; outb(VGA_SEQ_DATA, temp); - } + } - /* set HW cursor pattern, use pattern 0xF */ - outb(VGA_SEQ_INDEX, 0x1E); + /* set HW cursor pattern, use pattern 0xF */ + outb(VGA_SEQ_INDEX, 0x1E); temp = inb(VGA_SEQ_DATA) | 0xF0; outb(VGA_SEQ_DATA, temp); - /* disable the hardware cursor side pattern */ - outb(VGA_SEQ_INDEX, 0x1E); + /* disable the hardware cursor side pattern */ + outb(VGA_SEQ_INDEX, 0x1E); temp = inb(VGA_SEQ_DATA) & 0xF7; outb(VGA_SEQ_DATA, temp); } @@ -205,143 +207,145 @@ SiSLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) static void SiS300LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) { - SISPtr pSiS = SISPTR(pScrn); - int cursor_addr; - - if (pSiS->TurboQueue) - cursor_addr = pScrn->videoRam-512-1; /* 1K boundary */ - else - cursor_addr = pScrn->videoRam - 1; /* 1K boundary */ - - memcpy((unsigned char *)pSiS->FbBase + cursor_addr * 1024, src, 1024); - sis300SetCursorAddress(cursor_addr) - sis300SetCursorPatternSelect(0) - if (pSiS->VBFlags & CRT2_ENABLE) { - sis301SetCursorAddress(cursor_addr) - sis301SetCursorPatternSelect(0) - } + SISPtr pSiS = SISPTR(pScrn); + int cursor_addr; + + if (pSiS->TurboQueue) + cursor_addr = pScrn->videoRam-512-1; /* 1K boundary */ + else + cursor_addr = pScrn->videoRam - 1; /* 1K boundary */ + + ErrorF("cursor_addr value: %x\n"); + + memcpy((unsigned char *)pSiS->FbBase + cursor_addr * 1024, src, 1024); + sis300SetCursorAddress(cursor_addr) + sis300SetCursorPatternSelect(0) + if (pSiS->VBFlags & CRT2_ENABLE) { + sis301SetCursorAddress(cursor_addr) + sis301SetCursorPatternSelect(0) + } } static Bool SiSUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) { - return TRUE; + return TRUE; } static Bool SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - DisplayModePtr mode = pScrn->currentMode; - SISPtr pSiS = SISPTR(pScrn); - - switch (pSiS->Chipset) { - case PCI_CHIP_SIS300: - case PCI_CHIP_SIS630: - if (mode->Flags & V_INTERLACE) - return FALSE; - break; - } - return TRUE; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + DisplayModePtr mode = pScrn->currentMode; + SISPtr pSiS = SISPTR(pScrn); + + switch (pSiS->Chipset) { + case PCI_CHIP_SIS300: + case PCI_CHIP_SIS630: + if (mode->Flags & V_INTERLACE) + return FALSE; + break; + } + return TRUE; } -#ifdef IMP_REALIZE_CURSOR +#ifdef IMP_REALIZE_CURSOR static unsigned char * SiSRealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) { - unsigned char *mem; - int size = (infoPtr->MaxWidth * infoPtr->MaxHeight) >> 2; - int w, h; - int i, j; - unsigned char *srcM, *srcS, *dst, s, m; - - if (!(mem=xcalloc(1,size))) - return NULL; - dst = mem; - - srcS = pCurs->bits->source; - srcM = pCurs->bits->mask; - h = pCurs->bits->height; - if (h > infoPtr->MaxHeight) - h = infoPtr->MaxHeight; - w = (pCurs->bits->width + 31)/32*4; - for (i=0; i<infoPtr->MaxHeight; i++, dst+=16) { - for (j=0; j<infoPtr->MaxWidth/8; j++) { - if (i<h && j<w) { - s = *srcS++; - m = *srcM++; - s = s&m; - m = ~m; - dst[j*2] = ((m&0x01) << 7) | ((s&0x01) << 6) | - ((m&0x02) << 4) | ((s&0x02) << 3) | - ((m&0x04) << 1) | (s&0x04) | - ((m&0x08) >> 2) | ((s&0x08) >> 3) ; - dst[j*2+1] = ((m&0x10) << 3) | ((s&0x10)<<2) | - (m&0x20) | ((s&0x20) >> 1) | - ((m&0x40) >> 3) | ((s&0x40) >> 4) | - ((m&0x80) >> 6) | ((s&0x80) >> 7) ; - } - else { - dst[j*2] = 0xAA; - dst[j*2+1] = 0xAA; - } - } - } - - return mem; + unsigned char *mem; + int size = (infoPtr->MaxWidth * infoPtr->MaxHeight) >> 2; + int w, h; + int i, j; + unsigned char *srcM, *srcS, *dst, s, m; + + if (!(mem=xcalloc(1,size))) + return NULL; + dst = mem; + + srcS = pCurs->bits->source; + srcM = pCurs->bits->mask; + h = pCurs->bits->height; + if (h > infoPtr->MaxHeight) + h = infoPtr->MaxHeight; + w = (pCurs->bits->width + 31)/32*4; + for (i=0; i<infoPtr->MaxHeight; i++, dst+=16) { + for (j=0; j<infoPtr->MaxWidth/8; j++) { + if (i<h && j<w) { + s = *srcS++; + m = *srcM++; + s = s&m; + m = ~m; + dst[j*2] = ((m&0x01) << 7) | ((s&0x01) << 6) | + ((m&0x02) << 4) | ((s&0x02) << 3) | + ((m&0x04) << 1) | (s&0x04) | + ((m&0x08) >> 2) | ((s&0x08) >> 3) ; + dst[j*2+1] = ((m&0x10) << 3) | ((s&0x10)<<2) | + (m&0x20) | ((s&0x20) >> 1) | + ((m&0x40) >> 3) | ((s&0x40) >> 4) | + ((m&0x80) >> 6) | ((s&0x80) >> 7) ; + } + else { + dst[j*2] = 0xAA; + dst[j*2+1] = 0xAA; + } + } + } + + return mem; } #endif Bool SiSHWCursorInit(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - SISPtr pSiS = SISPTR(pScrn); - xf86CursorInfoPtr infoPtr; - - PDEBUG(ErrorF("HW Cursor Init\n")); - infoPtr = xf86CreateCursorInfoRec(); - if(!infoPtr) return FALSE; - - pSiS->CursorInfoPtr = infoPtr; - - infoPtr->MaxWidth = 64; - infoPtr->MaxHeight = 64; - switch (pSiS->Chipset) { - case PCI_CHIP_SIS300: - case PCI_CHIP_SIS630: - case PCI_CHIP_SIS540: - infoPtr->ShowCursor = SiS300ShowCursor; - infoPtr->HideCursor = SiS300HideCursor; - infoPtr->SetCursorPosition = SiS300SetCursorPosition; - infoPtr->SetCursorColors = SiS300SetCursorColors; - infoPtr->LoadCursorImage = SiS300LoadCursorImage; - infoPtr->UseHWCursor = SiS300UseHWCursor; - infoPtr->Flags = - HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | - HARDWARE_CURSOR_INVERT_MASK | - HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | - HARDWARE_CURSOR_AND_SOURCE_WITH_MASK | - HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK | - HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64; - break; - default: - infoPtr->SetCursorPosition = SiSSetCursorPosition; - infoPtr->ShowCursor = SiSShowCursor; - infoPtr->HideCursor = SiSHideCursor; - infoPtr->SetCursorColors = SiSSetCursorColors; - infoPtr->LoadCursorImage = SiSLoadCursorImage; - infoPtr->UseHWCursor = SiSUseHWCursor; - infoPtr->Flags = - HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | - HARDWARE_CURSOR_INVERT_MASK | - HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | - HARDWARE_CURSOR_AND_SOURCE_WITH_MASK | - HARDWARE_CURSOR_NIBBLE_SWAPPED | - HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SISPtr pSiS = SISPTR(pScrn); + xf86CursorInfoPtr infoPtr; + + PDEBUG(ErrorF("HW Cursor Init\n")); + infoPtr = xf86CreateCursorInfoRec(); + if(!infoPtr) + return FALSE; + + pSiS->CursorInfoPtr = infoPtr; + + infoPtr->MaxWidth = 64; + infoPtr->MaxHeight = 64; + switch (pSiS->Chipset) { + case PCI_CHIP_SIS300: + case PCI_CHIP_SIS630: + case PCI_CHIP_SIS540: + infoPtr->ShowCursor = SiS300ShowCursor; + infoPtr->HideCursor = SiS300HideCursor; + infoPtr->SetCursorPosition = SiS300SetCursorPosition; + infoPtr->SetCursorColors = SiS300SetCursorColors; + infoPtr->LoadCursorImage = SiS300LoadCursorImage; + infoPtr->UseHWCursor = SiS300UseHWCursor; + infoPtr->Flags = + HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | + HARDWARE_CURSOR_INVERT_MASK | + HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | + HARDWARE_CURSOR_AND_SOURCE_WITH_MASK | + HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK | + HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64; break; - } - - return(xf86InitCursor(pScreen, infoPtr)); + default: + infoPtr->SetCursorPosition = SiSSetCursorPosition; + infoPtr->ShowCursor = SiSShowCursor; + infoPtr->HideCursor = SiSHideCursor; + infoPtr->SetCursorColors = SiSSetCursorColors; + infoPtr->LoadCursorImage = SiSLoadCursorImage; + infoPtr->UseHWCursor = SiSUseHWCursor; + infoPtr->Flags = + HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | + HARDWARE_CURSOR_INVERT_MASK | + HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | + HARDWARE_CURSOR_AND_SOURCE_WITH_MASK | + HARDWARE_CURSOR_NIBBLE_SWAPPED | + HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1; + break; + } + + return(xf86InitCursor(pScreen, infoPtr)); } - diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h index 30d8b8eb9..76cb50765 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h @@ -25,9 +25,9 @@ * Mitani Hiroshi <hmitani@drl.mei.co.jp> * David Thomas <davtom@dream.org.uk>. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h,v 1.1 2000/02/12 20:45:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h,v 1.2 2001/04/19 12:40:33 alanh Exp $ */ -#define CS(x) (0x8500+(x<<2)) +#define CS(x) (0x8500+(x<<2)) #define sis300EnableHWCursor()\ *(volatile CARD32 *)(pSiS->IOBase + CS(0)) |= 0x40000000; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c index bedd1bc1d..d0c907c95 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c @@ -25,7 +25,7 @@ * Mitani Hiroshi <hmitani@drl.mei.co.jp> * David Thomas <davtom@dream.org.uk>. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.18 2000/12/02 15:30:50 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.19 2001/04/19 12:40:33 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -37,35 +37,35 @@ #include "vgaHW.h" #include "sis.h" +#include "sis_dac.h" #include "sis_regs.h" #include "sis_vb.h" - -static void SiSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg); -static void SiSRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg); - -static void SiS300Save(ScrnInfoPtr pScrn, SISRegPtr sisReg); -static void SiS301Save(ScrnInfoPtr pScrn, SISRegPtr sisReg); -static void SiSLVDSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg); -static void SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg); -static void SiS301Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg); -static void SiSLVDSRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg); -static void SiSChrontelSave(ScrnInfoPtr pScrn, SISRegPtr sisReg); - -static void SiS301LoadPalette(ScrnInfoPtr pScrn, int numColors, - int *indicies, LOCO *colors, VisualPtr pVisual); - -static void SiS300Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, - unsigned short *Low, unsigned short *High); -static void SiS630Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, - unsigned short *Low, unsigned short *High); -static void SiS530Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, - unsigned short *Low, unsigned short *High); -static void SiSThreshold(ScrnInfoPtr pScrn, DisplayModePtr mode, - unsigned short *Low, unsigned short *High); +#include "sis_bios.h" + +static void SiSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg); +static void SiSRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg); + +static void SiS300Save(ScrnInfoPtr pScrn, SISRegPtr sisReg); +static void SiS301Save(ScrnInfoPtr pScrn, SISRegPtr sisReg); +static void SiSLVDSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg); +static void SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg); +static void SiS301Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg); +static void SiSLVDSRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg); +static void SiSChrontelSave(ScrnInfoPtr pScrn, SISRegPtr sisReg); +static void SiS301LoadPalette(ScrnInfoPtr pScrn, int numColors, + int *indicies, LOCO *colors, VisualPtr pVisual); +static void SiS300Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, + unsigned short *Low, unsigned short *High); +static void SiS630Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, + unsigned short *Low, unsigned short *High); +static void SiS530Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, + unsigned short *Low, unsigned short *High); +static void SiSThreshold(ScrnInfoPtr pScrn, DisplayModePtr mode, + unsigned short *Low, unsigned short *High); +static void SetBlock(CARD16 port, CARD8 from, CARD8 to, CARD8 *DataPtr); unsigned short ch7005idx[0x11]={0x00,0x07,0x08,0x0a,0x0b,0x04,0x09,0x20,0x21,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f}; - int compute_vclk( int Clock, @@ -75,99 +75,99 @@ compute_vclk( int *out_sbit, int *out_scale) { - float f,x,y,t, error, min_error; - int n, dn, best_n=0, best_dn=0; - - /* - * Rules - * - * VCLK = 14.318 * (Divider/Post Scalar) * (Numerator/DeNumerator) - * Factor = (Divider/Post Scalar) - * Divider is 1 or 2 - * Post Scalar is 1, 2, 3, 4, 6 or 8 - * Numberator ranged from 1 to 128 - * DeNumerator ranged from 1 to 32 - * a. VCO = VCLK/Factor, suggest range is 150 to 250 Mhz - * b. Post Scalar selected from 1, 2, 4 or 8 first. - * c. DeNumerator selected from 2. - * - * According to rule a and b, the VCO ranges that can be scaled by - * rule b are: - * 150 - 250 (Factor = 1) - * 75 - 125 (Factor = 2) - * 37.5 - 62.5 (Factor = 4) - * 18.75 - 31.25 (Factor = 8) - * - * The following ranges use Post Scalar 3 or 6: - * 125 - 150 (Factor = 1.5) - * 62.5 - 75 (Factor = 3) - * 31.25 - 37.5 (Factor = 6) - * - * Steps: - * 1. divide the Clock by 2 until the Clock is less or equal to 31.25. - * 2. if the divided Clock is range from 18.25 to 31.25, than - * the Factor is 1, 2, 4 or 8. - * 3. if the divided Clock is range from 15.625 to 18.25, than - * the Factor is 1.5, 3 or 6. - * 4. select the Numberator and DeNumberator with minimum deviation. - * - * ** this function can select VCLK ranged from 18.75 to 250 Mhz - */ - f = (float) Clock; - f /= 1000.0; - if ((f > 250.0) || (f < 18.75)) - return 0; - - min_error = f; - y = 1.0; - x = f; - while (x > 31.25) { - y *= 2.0; - x /= 2.0; - } - if (x >= 18.25) { - x *= 8.0; - y = 8.0 / y; - } else if (x >= 15.625) { - x *= 12.0; - y = 12.0 / y; - } + float f,x,y,t, error, min_error; + int n, dn, best_n=0, best_dn=0; - t = y; - if (t == (float) 1.5) { - *out_div = 2; - t *= 2.0; - } else { - *out_div = 1; - } - if (t > (float) 4.0) { - *out_sbit = 1; - t /= 2.0; - } else { - *out_sbit = 0; - } + /* + * Rules + * + * VCLK = 14.318 * (Divider/Post Scalar) * (Numerator/DeNumerator) + * Factor = (Divider/Post Scalar) + * Divider is 1 or 2 + * Post Scalar is 1, 2, 3, 4, 6 or 8 + * Numberator ranged from 1 to 128 + * DeNumerator ranged from 1 to 32 + * a. VCO = VCLK/Factor, suggest range is 150 to 250 Mhz + * b. Post Scalar selected from 1, 2, 4 or 8 first. + * c. DeNumerator selected from 2. + * + * According to rule a and b, the VCO ranges that can be scaled by + * rule b are: + * 150 - 250 (Factor = 1) + * 75 - 125 (Factor = 2) + * 37.5 - 62.5 (Factor = 4) + * 18.75 - 31.25 (Factor = 8) + * + * The following ranges use Post Scalar 3 or 6: + * 125 - 150 (Factor = 1.5) + * 62.5 - 75 (Factor = 3) + * 31.25 - 37.5 (Factor = 6) + * + * Steps: + * 1. divide the Clock by 2 until the Clock is less or equal to 31.25. + * 2. if the divided Clock is range from 18.25 to 31.25, than + * the Factor is 1, 2, 4 or 8. + * 3. if the divided Clock is range from 15.625 to 18.25, than + * the Factor is 1.5, 3 or 6. + * 4. select the Numberator and DeNumberator with minimum deviation. + * + * ** this function can select VCLK ranged from 18.75 to 250 Mhz + */ + f = (float) Clock; + f /= 1000.0; + if ((f > 250.0) || (f < 18.75)) + return 0; + + min_error = f; + y = 1.0; + x = f; + while (x > 31.25) { + y *= 2.0; + x /= 2.0; + } + if (x >= 18.25) { + x *= 8.0; + y = 8.0 / y; + } else if (x >= 15.625) { + x *= 12.0; + y = 12.0 / y; + } - *out_scale = (int) t; - - for (dn=2;dn<=32;dn++) { - for (n=1;n<=128;n++) { - error = x; - error -= ((float) 14.318 * (float) n / (float) dn); - if (error < (float) 0) - error = -error; - if (error < min_error) { - min_error = error; - best_n = n; - best_dn = dn; - } - } + t = y; + if (t == (float) 1.5) { + *out_div = 2; + t *= 2.0; + } else { + *out_div = 1; + } + if (t > (float) 4.0) { + *out_sbit = 1; + t /= 2.0; + } else { + *out_sbit = 0; + } + + *out_scale = (int) t; + + for (dn=2;dn<=32;dn++) { + for (n=1;n<=128;n++) { + error = x; + error -= ((float) 14.318 * (float) n / (float) dn); + if (error < (float) 0) + error = -error; + if (error < min_error) { + min_error = error; + best_n = n; + best_dn = dn; + } } - *out_n = best_n; - *out_dn = best_dn; - PDEBUG(ErrorF("compute_vclk: Clock=%d, n=%d, dn=%d, div=%d, sbit=%d," - " scale=%d\n", Clock, best_n, best_dn, *out_div, - *out_sbit, *out_scale)); - return 1; + } + *out_n = best_n; + *out_dn = best_dn; + PDEBUG(ErrorF("compute_vclk: Clock=%d, n=%d, dn=%d, div=%d, sbit=%d," + " scale=%d\n", Clock, best_n, best_dn, *out_div, + *out_sbit, *out_scale)); + return 1; } @@ -469,11 +469,11 @@ SiS300Save(ScrnInfoPtr pScrn, SISRegPtr sisReg) /*sisReg->sisRegs3C2 = inb(0x3CC);*/ sisReg->sisRegs3C2 = inb(pSiS->RelIO+0x4c); - if ((pSiS->VBFlags & (VB_LVDS | CRT2_LCD))==(VB_LVDS|CRT2_LCD)) + if ((pSiS->VBFlags & (VB_LVDS | CRT2_LCD))==(VB_LVDS|CRT2_LCD)) (*pSiS->SiSSaveLVDS)(pScrn, sisReg); if ((pSiS->VBFlags & (VB_CHRONTEL | CRT2_TV))==(VB_CHRONTEL|CRT2_TV)) - (*pSiS->SiSSaveChrontel)(pScrn,sisReg); - if ((pSiS->VBFlags & (VB_301|VB_302|VB_303)) && (pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA))) + (*pSiS->SiSSaveChrontel)(pScrn,sisReg); + if ((pSiS->VBFlags & (VB_301|VB_302|VB_303)) && (pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA))) (*pSiS->SiSSave2)(pScrn, sisReg); } @@ -520,19 +520,17 @@ SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg) sisReg->sisRegs3C4[i], inb(VGA_SEQ_DATA)); } - if ((pSiS->VBFlags & (VB_LVDS | CRT2_LCD))==(VB_LVDS|CRT2_LCD)) + if ((pSiS->VBFlags & (VB_LVDS | CRT2_LCD))==(VB_LVDS|CRT2_LCD)) (*pSiS->SiSRestoreLVDS)(pScrn, sisReg); if ((pSiS->VBFlags & (VB_CHRONTEL | CRT2_TV))==(VB_CHRONTEL|CRT2_TV)) - (*pSiS->SiSRestoreChrontel)(pScrn,sisReg); - if ((pSiS->VBFlags & (VB_301|VB_302|VB_303)) && (pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA))) + (*pSiS->SiSRestoreChrontel)(pScrn,sisReg); + if ((pSiS->VBFlags & (VB_301|VB_302|VB_303)) && (pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA))) (*pSiS->SiSRestore2)(pScrn, sisReg); - /*outb(0x3C2, sisReg->sisRegs3C2);*/ outb(pSiS->RelIO+0x42, sisReg->sisRegs3C2); /* MemClock needs this to take effect */ - outw(VGA_SEQ_INDEX, 0x0100); /* Synchronous Reset */ outw(VGA_SEQ_INDEX, 0x0300); /* End Reset */ } @@ -540,108 +538,107 @@ SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg) static void SiS301Save(ScrnInfoPtr pScrn, SISRegPtr sisReg) { - SISPtr pSiS = SISPTR(pScrn); - int i; + SISPtr pSiS = SISPTR(pScrn); + int i; - /* for SiS301 only */ - for (i=0; i<0x29; i++) { - inSISIDXREG(pSiS->RelIO+4, i, sisReg->VBPart1[i]); - } - for (i=0; i<0x46; i++) { - inSISIDXREG(pSiS->RelIO+0x10, i, sisReg->VBPart2[i]); - } - for (i=0; i<0x3F; i++) { - inSISIDXREG(pSiS->RelIO+0x12, i, sisReg->VBPart3[i]); - } - for (i=0; i<0x1C; i++) { - inSISIDXREG(pSiS->RelIO+0x14, i, sisReg->VBPart4[i]); - } - sisReg->VBPart2[0] &= ~0x20; /* Disable VB Processor */ - sisReg->sisRegs3C4[0x32] &= ~0x20; /* Disable Lock Mode */ + /* for SiS301 only */ + for (i=0; i<0x29; i++) { + inSISIDXREG(pSiS->RelIO+4, i, sisReg->VBPart1[i]); + } + for (i=0; i<0x46; i++) { + inSISIDXREG(pSiS->RelIO+0x10, i, sisReg->VBPart2[i]); + } + for (i=0; i<0x3F; i++) { + inSISIDXREG(pSiS->RelIO+0x12, i, sisReg->VBPart3[i]); + } + for (i=0; i<0x1C; i++) { + inSISIDXREG(pSiS->RelIO+0x14, i, sisReg->VBPart4[i]); + } + sisReg->VBPart2[0] &= ~0x20; /* Disable VB Processor */ + sisReg->sisRegs3C4[0x32] &= ~0x20; /* Disable Lock Mode */ } static void SiSLVDSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg) { - SISPtr pSiS = SISPTR(pScrn); - int i; + SISPtr pSiS = SISPTR(pScrn); + int i; - /* for SiS LVDS only */ - for (i=0; i<0x29; i++) { - inSISIDXREG(pSiS->RelIO+4, i, sisReg->VBPart1[i]); - } - sisReg->sisRegs3C4[0x32] &= ~0x20; /* Disable Lock Mode */ + /* for SiS LVDS only */ + for (i=0; i<0x29; i++) { + inSISIDXREG(pSiS->RelIO+4, i, sisReg->VBPart1[i]); + } + sisReg->sisRegs3C4[0x32] &= ~0x20; /* Disable Lock Mode */ } static void SiSChrontelSave(ScrnInfoPtr pScrn, SISRegPtr sisReg) { - SISPtr pSiS = SISPTR(pScrn); - int i; + SISPtr pSiS = SISPTR(pScrn); + int i; - /* for SiS Chrontel TV */ - for (i=0; i<0x29; i++) { - inSISIDXREG(pSiS->RelIO+4, i, sisReg->VBPart1[i]); - } - for (i=0; i<0x11; i++) - sisReg->ch7005[i]=GetCH7005(ch7005idx[i]); + /* for SiS Chrontel TV */ + for (i=0; i<0x29; i++) { + inSISIDXREG(pSiS->RelIO+4, i, sisReg->VBPart1[i]); + } + for (i=0; i<0x11; i++) + sisReg->ch7005[i]=GetCH7005(ch7005idx[i]); - sisReg->sisRegs3C4[0x32] &= ~0x20; /* Disable Lock Mode */ + sisReg->sisRegs3C4[0x32] &= ~0x20; /* Disable Lock Mode */ } - static void SiS301Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg) { - SISPtr pSiS = SISPTR(pScrn); - unsigned char temp, temp1; - - DisableBridge(pSiS->RelIO+0x30); - UnLockCRT2(pSiS->RelIO+0x30); - - /* SetCRT2ModeRegs() */ - outSISIDXREG(pSiS->RelIO+0x04, 4, 0); - outSISIDXREG(pSiS->RelIO+0x04, 5, 0); - outSISIDXREG(pSiS->RelIO+0x04, 6, 0); - outSISIDXREG(pSiS->RelIO+0x04, 0, sisReg->VBPart1[0]); - outSISIDXREG(pSiS->RelIO+0x04, 1, sisReg->VBPart1[1]); - outSISIDXREG(pSiS->RelIO+0x14, 0x0D, sisReg->VBPart4[0x0D]); - outSISIDXREG(pSiS->RelIO+0x14, 0x0C, sisReg->VBPart4[0x0C]); - - if (!(sisReg->sisRegs3D4[0x30] & 0x03) && - (sisReg->sisRegs3D4[0x31] & 0x20)) { /* disable CRT2 */ - LockCRT2(pSiS->RelIO+0x30); - return; - } - SetBlock(pSiS->RelIO+0x04, 0x02, 0x23, &(sisReg->VBPart1[0x02])); - SetBlock(pSiS->RelIO+0x10, 0x00, 0x45, &(sisReg->VBPart2[0x00])); - SetBlock(pSiS->RelIO+0x12, 0x00, 0x3E, &(sisReg->VBPart3[0x00])); - SetBlock(pSiS->RelIO+0x14, 0x0E, 0x11, &(sisReg->VBPart4[0x0E])); - SetBlock(pSiS->RelIO+0x14, 0x13, 0x1B, &(sisReg->VBPart4[0x13])); - - outSISIDXREG(pSiS->RelIO+0x14, 0x0A, 1); - outSISIDXREG(pSiS->RelIO+0x14, 0x0B, sisReg->VBPart4[0x0B]); - outSISIDXREG(pSiS->RelIO+0x14, 0x0A, sisReg->VBPart4[0x0A]); - outSISIDXREG(pSiS->RelIO+0x14, 0x12, 0); - outSISIDXREG(pSiS->RelIO+0x14, 0x12, sisReg->VBPart4[0x12]); - - - temp1 = 0; - if(!(pSiS->VBFlags & CRT2_VGA)) { - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x31, temp); - if (temp & (SET_IN_SLAVE_MODE >> 8)) { - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x30, temp); - if (!(temp & (SET_CRT2_TO_RAMDAC >> 8))) { - temp1 = 0x20; - } - } - } - setSISIDXREG(pSiS->RelIO+SROFFSET, 0x32, ~0x20, temp1); - orSISIDXREG(pSiS->RelIO+SROFFSET, 0x1E, 0x20); - andSISIDXREG(pSiS->RelIO+SROFFSET, 1, ~0x20); /* DisplayOn */ + SISPtr pSiS = SISPTR(pScrn); + unsigned char temp, temp1; + + DisableBridge(pSiS->RelIO+0x30); + UnLockCRT2(pSiS->RelIO+0x30); + + /* SetCRT2ModeRegs() */ + outSISIDXREG(pSiS->RelIO+0x04, 4, 0); + outSISIDXREG(pSiS->RelIO+0x04, 5, 0); + outSISIDXREG(pSiS->RelIO+0x04, 6, 0); + outSISIDXREG(pSiS->RelIO+0x04, 0, sisReg->VBPart1[0]); + outSISIDXREG(pSiS->RelIO+0x04, 1, sisReg->VBPart1[1]); + outSISIDXREG(pSiS->RelIO+0x14, 0x0D, sisReg->VBPart4[0x0D]); + outSISIDXREG(pSiS->RelIO+0x14, 0x0C, sisReg->VBPart4[0x0C]); + + if (!(sisReg->sisRegs3D4[0x30] & 0x03) && + (sisReg->sisRegs3D4[0x31] & 0x20)) { /* disable CRT2 */ + LockCRT2(pSiS->RelIO+0x30); + return; + } + SetBlock(pSiS->RelIO+0x04, 0x02, 0x23, &(sisReg->VBPart1[0x02])); + SetBlock(pSiS->RelIO+0x10, 0x00, 0x45, &(sisReg->VBPart2[0x00])); + SetBlock(pSiS->RelIO+0x12, 0x00, 0x3E, &(sisReg->VBPart3[0x00])); + SetBlock(pSiS->RelIO+0x14, 0x0E, 0x11, &(sisReg->VBPart4[0x0E])); + SetBlock(pSiS->RelIO+0x14, 0x13, 0x1B, &(sisReg->VBPart4[0x13])); + + outSISIDXREG(pSiS->RelIO+0x14, 0x0A, 1); + outSISIDXREG(pSiS->RelIO+0x14, 0x0B, sisReg->VBPart4[0x0B]); + outSISIDXREG(pSiS->RelIO+0x14, 0x0A, sisReg->VBPart4[0x0A]); + outSISIDXREG(pSiS->RelIO+0x14, 0x12, 0); + outSISIDXREG(pSiS->RelIO+0x14, 0x12, sisReg->VBPart4[0x12]); - EnableBridge(pSiS->RelIO+0x30); - LockCRT2(pSiS->RelIO+0x30); + + temp1 = 0; + if(!(pSiS->VBFlags & CRT2_VGA)) { + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x31, temp); + if (temp & (SET_IN_SLAVE_MODE >> 8)) { + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x30, temp); + if (!(temp & (SET_CRT2_TO_RAMDAC >> 8))) { + temp1 = 0x20; + } + } + } + setSISIDXREG(pSiS->RelIO+SROFFSET, 0x32, ~0x20, temp1); + orSISIDXREG(pSiS->RelIO+SROFFSET, 0x1E, 0x20); + andSISIDXREG(pSiS->RelIO+SROFFSET, 1, ~0x20); /* DisplayOn */ + + EnableBridge(pSiS->RelIO+0x30); + LockCRT2(pSiS->RelIO+0x30); } static void @@ -677,16 +674,16 @@ static void SiSChrontelRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg) { SISPtr pSiS = SISPTR(pScrn); - int i; - unsigned short wtemp; + int i; + unsigned short wtemp; DisableBridge(pSiS->RelIO+0x30); UnLockCRT2(pSiS->RelIO+0x30); - for (i=0; i<0x11; i++) - { wtemp = ((sisReg->ch7005[i]) << 8) + (ch7005idx[i] & 0x00FF); - SetCH7005(wtemp); - } + for (i=0; i<0x11; i++) + { wtemp = ((sisReg->ch7005[i]) << 8) + (ch7005idx[i] & 0x00FF); + SetCH7005(wtemp); + } /* SetCRT2ModeRegs() */ outSISIDXREG(pSiS->RelIO+0x04, 4, 0); @@ -709,6 +706,8 @@ SiSChrontelRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg) LockCRT2(pSiS->RelIO+0x30); } + + unsigned int SiSddc1Read(ScrnInfoPtr pScrn) { @@ -737,8 +736,9 @@ SiSddc1Read(ScrnInfoPtr pScrn) /* Auxiliary function to find real memory clock (in Khz) */ int SiSMclk(SISPtr pSiS) -{ int mclk; - unsigned char Num, Denum, Base; +{ + int mclk; + unsigned char Num, Denum, Base; /* Numerator */ switch (pSiS->Chipset) { @@ -757,7 +757,7 @@ SiSMclk(SISPtr pSiS) read_xr(MemClock1,Denum); mclk=mclk/((Denum & 0x1f)+1); - /* Divider. Don't seems to work for mclk */ + /* Divider. Don't seems to work for mclk in older cards */ if ( (Num & 0x80)!=0 ) { mclk = mclk*2; } @@ -806,55 +806,60 @@ SiSMclk(SISPtr pSiS) return(mclk); } -/***** Only for SiS 5597 / 6326 *****/ -/* Returns estimated memory bandwidth in Kbits/sec (for dotclock defaults) */ -/* Currently, a very rough estimate (4 cycles / read ; 2 for fast_vram) */ -int sisMemBandWidth(ScrnInfoPtr pScrn) -{ int band; - SISPtr pSiS = SISPTR(pScrn); - SISRegPtr pReg = &pSiS->ModeReg; - - band=pSiS->MemClock; - - if (((pReg->sisRegs3C4[Mode64] >> 1) & 3) == 0) /* Only 1 bank Vram */ - band = (band * 8); - else - band = (band * 16); - - if ((pReg->sisRegs3C4[ExtMiscCont5] & 0xC0) == 0xC0) band=band*2; - - return(band); -} +int SiSMemBandWidth(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + SISRegPtr pReg = &pSiS->ModeReg; -const float magic300[4] = { 1.2, 1.368421, 2.263158, 1.2}; -const float magic630[4] = { 1.441177, 1.441177, 2.588235, 1.441177 }; -int sis300MemBandWidth(ScrnInfoPtr pScrn) -{ - SISPtr pSiS = SISPTR(pScrn); int bus = pSiS->BusWidth; int mclk = pSiS->MemClock; int bpp = pScrn->bitsPerPixel; - float magic, total; - - if (pSiS->Chipset==PCI_CHIP_SIS300) - magic = magic300[bus/64]; - else - magic = magic630[bus/64]; + float magic, total; + const float magic300[4] = { 1.2, 1.368421, 2.263158, 1.2}; + const float magic630[4] = { 1.441177, 1.441177, 2.588235, 1.441177 }; - PDEBUG(ErrorF("mclk: %d, bus: %d, magic: %g, bpp: %d\n", - mclk, bus, magic, bpp)); + switch (pSiS->Chipset) { + case PCI_CHIP_SIS6326: + return 175000; /* guest */ + + case PCI_CHIP_SIS5597: + if (((pReg->sisRegs3C4[Mode64] >> 1) & 3) == 0) /* Only 1 bank Vram */ + mclk = (mclk * 8); + else + mclk = (mclk * 16); + if ((pReg->sisRegs3C4[ExtMiscCont5] & 0xC0) == 0xC0) + mclk=mclk*2; + return(mclk); - total = mclk*bus/bpp; - ErrorF("Total Adapter Bandwidth is %gM\n", total/1000); - if (pSiS->VBFlags & CRT2_ENABLE) { - if (total/2 > 540000) - total = total - 540000; + case PCI_CHIP_SIS300: + case PCI_CHIP_SIS540: + case PCI_CHIP_SIS630: + if (pSiS->Chipset==PCI_CHIP_SIS300) + magic = magic300[bus/64]; else - total = total/2; - ErrorF("CRT1 Used Bandwidth is %gM\n", total/1000); - } + magic = magic630[bus/64]; + + PDEBUG(ErrorF("mclk: %d, bus: %d, magic: %g, bpp: %d\n", + mclk, bus, magic, bpp)); + + total = mclk*bus/bpp; + + ErrorF("Total Adapter Bandwidth is %gM\n", total/1000); + + if (pSiS->VBFlags & CRT2_ENABLE) { + if (total/2 > 540000) + total -= 540000; + else + total /= 2; + ErrorF("CRT1 Used Bandwidth is %gM\n", total/1000); + } + return (int)(total/magic); - return (int)(total/magic); + case PCI_CHIP_SIS530: + return 230000; /* guest */ + default: + return 135000; /* guest */ + } } void @@ -864,23 +869,32 @@ SISLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, LOCO *colors, SISPtr pSiS = SISPTR(pScrn); int i, index; - PDEBUG(ErrorF("SISLoadPalette(%d)\n", numColors)); + PDEBUG(ErrorF("SiSLoadPalette(%d)\n", numColors)); for (i=0; i<numColors; i++) { index = indicies[i]; - /*outSISREG(0x3c8, index); +#if 0 + outSISREG(0x3c8, index); outSISREG(0x3c9, colors[index].red >> 2); outSISREG(0x3c9, colors[index].green >> 2); - outSISREG(0x3c9, colors[index].blue >> 2);*/ + outSISREG(0x3c9, colors[index].blue >> 2); +#endif outSISREG(pSiS->RelIO+0x48, index); outSISREG(pSiS->RelIO+0x49, colors[index].red >> 2); outSISREG(pSiS->RelIO+0x49, colors[index].green >> 2); outSISREG(pSiS->RelIO+0x49, colors[index].blue >> 2); } - if (pSiS->VBFlags & CRT2_ENABLE) { - (*pSiS->LoadCRT2Palette)(pScrn, numColors, indicies, - colors, pVisual); + switch (pSiS->Chipset) { + case PCI_CHIP_SIS630: + case PCI_CHIP_SIS540: + case PCI_CHIP_SIS300: + if (pSiS->VBFlags & CRT2_ENABLE) { + (*pSiS->LoadCRT2Palette)(pScrn, numColors, indicies, + colors, pVisual); + } + break; } } + static void SiS301LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, LOCO *colors, VisualPtr pVisual) @@ -920,66 +934,65 @@ static void SiS630Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned short *Low, unsigned short *High) { - SISPtr pSiS = SISPTR(pScrn); - int mclk = pSiS->MemClock; - int vclk = mode->Clock; - int bpp = pScrn->bitsPerPixel/8; - int buswidth = pSiS->BusWidth; - CARD32 temp; - PCITAG NBridge; - int cyclea; - int low, lowa; + SISPtr pSiS = SISPTR(pScrn); + int mclk = pSiS->MemClock; + int vclk = mode->Clock; + int bpp = pScrn->bitsPerPixel/8; + int buswidth = pSiS->BusWidth; + CARD32 temp; + PCITAG NBridge; + int cyclea; + int low, lowa; - int i, j; + int i, j; - if (!bpp) bpp = 1; + if (!bpp) + bpp = 1; - i = 0; - j = buswidth/128; + i = 0; + j = buswidth/128; - while (1) { + while (1) { #ifdef DEBUG - ErrorF("Config %d GT = %d, QC = %x, CycleA = %d\n", - i, qconfig[i].GT, qconfig[i].QC, cycleA[i][j]); + ErrorF("Config %d GT = %d, QC = %x, CycleA = %d\n", + i, qconfig[i].GT, qconfig[i].QC, cycleA[i][j]); #endif - cyclea = cycleA[i][j]; - lowa = cyclea * vclk * bpp; - lowa = (lowa + (mclk-1)) / mclk; - lowa = (lowa + 15) / 16; - low = lowa + 1; - if (low <= 0x13) - break; - else - if (i < 19) - i++; - else { - low = 0x13; - PDEBUG(ErrorF("This mode may has threshold " - "problem and had better removed\n")); - break; - } - } - PDEBUG(ErrorF("Using Config %d with CycleA = %d\n", i, cyclea)); - *Low = low; - if (lowa+4 > 15) - *High = 0x0F; + cyclea = cycleA[i][j]; + lowa = cyclea * vclk * bpp; + lowa = (lowa + (mclk-1)) / mclk; + lowa = (lowa + 15) / 16; + low = lowa + 1; + if (low <= 0x13) + break; else - *High = lowa+4; - - /* write PCI configuration space */ - NBridge = pciTag(0, 0, 0); - temp = pciReadLong(NBridge, 0x50); - temp &= 0xF0FFFFFF; - temp |= qconfig[i].QC << 24; - pciWriteLong(NBridge, 0x50, temp); - - temp = pciReadLong(NBridge, 0xA0); - temp &= 0xF0FFFFFF; - temp |= qconfig[i].GT << 24; - pciWriteLong(NBridge, 0xA0, temp); - - + if (i < 19) + i++; + else { + low = 0x13; + PDEBUG(ErrorF("This mode may has threshold " + "problem and had better removed\n")); + break; + } + } + PDEBUG(ErrorF("Using Config %d with CycleA = %d\n", i, cyclea)); + *Low = low; + if (lowa+4 > 15) + *High = 0x0F; + else + *High = lowa+4; + + /* write PCI configuration space */ + NBridge = pciTag(0, 0, 0); + temp = pciReadLong(NBridge, 0x50); + temp &= 0xF0FFFFFF; + temp |= qconfig[i].QC << 24; + pciWriteLong(NBridge, 0x50, temp); + + temp = pciReadLong(NBridge, 0xA0); + temp &= 0xF0FFFFFF; + temp |= qconfig[i].GT << 24; + pciWriteLong(NBridge, 0xA0, temp); } struct funcargc { @@ -1001,94 +1014,95 @@ static void SiS300Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned short *Low, unsigned short *High) { - SISPtr pSiS = SISPTR(pScrn); - SISRegPtr pReg = &pSiS->ModeReg; - int mclk = pSiS->MemClock; - int vclk = mode->Clock; - int bpp = pScrn->bitsPerPixel/8; - int lowa, lowb, low; - struct funcargc *p; - unsigned int i, j; - - pReg->sisRegs3C4[0x16] = pSiS->SavedReg.sisRegs3C4[0x16]; - - if (!bpp) bpp = 1; - - do { - i = GETBITSTR(pReg->sisRegs3C4[0x18], 6:5, 2:1) | - GETBITS(pReg->sisRegs3C4[0x18], 1:1); - j = GETBITSTR(pReg->sisRegs3C4[0x14], 7:6, 3:2) | - GETBITS(pReg->sisRegs3C4[0x16], 7:6); - p = &funca[j]; - - lowa = (p->base + p->inc*timing[i])*vclk*bpp; - lowa = (lowa + (mclk-1)) / mclk; - lowa = (lowa + 15)/16; - - p = &funcb[j]; - lowb = (p->base + p->inc*timing[i])*vclk*bpp; - lowb = (lowb + (mclk-1)) / mclk; - lowb = (lowb + 15)/16; - - if (lowb < 4) - lowb = 0; - else - lowb -= 4; + SISPtr pSiS = SISPTR(pScrn); + SISRegPtr pReg = &pSiS->ModeReg; + int mclk = pSiS->MemClock; + int vclk = mode->Clock; + int bpp = pScrn->bitsPerPixel/8; + int lowa, lowb, low; + struct funcargc *p; + unsigned int i, j; + + pReg->sisRegs3C4[0x16] = pSiS->SavedReg.sisRegs3C4[0x16]; + + if (!bpp) bpp = 1; + + do { + i = GETBITSTR(pReg->sisRegs3C4[0x18], 6:5, 2:1) | + GETBITS(pReg->sisRegs3C4[0x18], 1:1); + j = GETBITSTR(pReg->sisRegs3C4[0x14], 7:6, 3:2) | + GETBITS(pReg->sisRegs3C4[0x16], 7:6); + p = &funca[j]; + + lowa = (p->base + p->inc*timing[i])*vclk*bpp; + lowa = (lowa + (mclk-1)) / mclk; + lowa = (lowa + 15)/16; + + p = &funcb[j]; + lowb = (p->base + p->inc*timing[i])*vclk*bpp; + lowb = (lowb + (mclk-1)) / mclk; + lowb = (lowb + 15)/16; + + if (lowb < 4) + lowb = 0; + else + lowb -= 4; - low = (lowa > lowb)? lowa: lowb; + low = (lowa > lowb)? lowa: lowb; - low++; + low++; - if (low <= 0x13) { - break; - } else { - i = GETBITS(pReg->sisRegs3C4[0x16], 7:6); - if (!i) { - low = 0x13; - break; - } else { - i--; - pReg->sisRegs3C4[0x16] &= 0x3C; - pReg->sisRegs3C4[0x16] |= (i << 6); - } - } - } while (1); + if (low <= 0x13) { + break; + } else { + i = GETBITS(pReg->sisRegs3C4[0x16], 7:6); + if (!i) { + low = 0x13; + break; + } else { + i--; + pReg->sisRegs3C4[0x16] &= 0x3C; + pReg->sisRegs3C4[0x16] |= (i << 6); + } + } + } while (1); - *Low = low; - if (low+3 > 15) - *High = 0x0F; - else - *High = low+3; + *Low = low; + if (low+3 > 15) + *High = 0x0F; + else + *High = low+3; } -static void +static void SiS530Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned short *Low, unsigned short *High) { - SISPtr pSiS = SISPTR(pScrn); - unsigned int factor, z; - unsigned int vclk = mode->Clock, - bpp = pScrn->bitsPerPixel, - mclk = pSiS->MemClock, - buswidth = pSiS->BusWidth; - - if (pSiS->Flags & UMA) - factor = 0x60; - else - factor = 0x30; - z = factor * vclk * bpp; - z = z / mclk / buswidth; - *Low = (z+1)/2 + 4; - if (*Low > 0x1F) - *Low = 0x1F; - - *High = 0x1F; + SISPtr pSiS = SISPTR(pScrn); + unsigned int factor, z; + unsigned int vclk = mode->Clock, + bpp = pScrn->bitsPerPixel, + mclk = pSiS->MemClock, + buswidth = pSiS->BusWidth; + + if (pSiS->Flags & UMA) + factor = 0x60; + else + factor = 0x30; + z = factor * vclk * bpp; + z = z / mclk / buswidth; + *Low = (z+1)/2 + 4; + if (*Low > 0x1F) + *Low = 0x1F; + + *High = 0x1F; } -static void +static void SiSThreshold(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned short *Low, unsigned short *High) { + return; } @@ -1187,65 +1201,66 @@ void SiSIODump(ScrnInfoPtr pScrn) outw(pSiS->RelIO+0x44, SR5State << 8 | 0x05); } + void SISDACPreInit(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); - switch (pSiS->Chipset) { - case PCI_CHIP_SIS630: - case PCI_CHIP_SIS540: - pSiS->MaxClock = sis300MemBandWidth(pScrn); - pSiS->SiSSave = SiS300Save; - pSiS->SiSSave2 = SiS301Save; - pSiS->SiSSaveLVDS = SiSLVDSSave; - pSiS->SiSSaveChrontel = SiSChrontelSave; - pSiS->SiSRestore = SiS300Restore; - pSiS->SiSRestore2 = SiS301Restore; - pSiS->SiSRestoreLVDS = SiSLVDSRestore; - pSiS->SiSRestoreChrontel= SiSChrontelRestore; - pSiS->LoadCRT2Palette = SiS301LoadPalette; - pSiS->SetThreshold = SiS630Threshold; - break; - case PCI_CHIP_SIS300: - pSiS->MaxClock = sis300MemBandWidth(pScrn); - pSiS->SiSSave = SiS300Save; - pSiS->SiSSave2 = SiS301Save; - pSiS->SiSSaveLVDS = SiSLVDSSave; - pSiS->SiSSaveChrontel = SiSChrontelSave; - pSiS->SiSRestore = SiS300Restore; - pSiS->SiSRestore2 = SiS301Restore; - pSiS->SiSRestoreLVDS = SiSLVDSRestore; - pSiS->SiSRestoreChrontel= SiSChrontelRestore; - pSiS->LoadCRT2Palette = SiS301LoadPalette; - pSiS->SetThreshold = SiS300Threshold; - break; - case PCI_CHIP_SIS530: - pSiS->MaxClock = 230000; /* Guest */ - pSiS->SiSRestore = SiSRestore; - pSiS->SiSSave = SiSSave; - pSiS->SetThreshold = SiS530Threshold; - break; - case PCI_CHIP_SIS6326: - pSiS->MaxClock = 175000; /* Guest */ - pSiS->SiSRestore = SiSRestore; - pSiS->SiSSave = SiSSave; - pSiS->SetThreshold = SiSThreshold; - break; - default: - pSiS->MaxClock = 135000; /* Guest */ - pSiS->SiSRestore = SiSRestore; - pSiS->SiSSave = SiSSave; - pSiS->SetThreshold = SiSThreshold; - } + switch (pSiS->Chipset) { + case PCI_CHIP_SIS630: + case PCI_CHIP_SIS540: + pSiS->MaxClock = SiSMemBandWidth(pScrn); + pSiS->SiSSave = SiS300Save; + pSiS->SiSSave2 = SiS301Save; + pSiS->SiSSaveLVDS = SiSLVDSSave; + pSiS->SiSSaveChrontel = SiSChrontelSave; + pSiS->SiSRestore = SiS300Restore; + pSiS->SiSRestore2 = SiS301Restore; + pSiS->SiSRestoreLVDS = SiSLVDSRestore; + pSiS->SiSRestoreChrontel= SiSChrontelRestore; + pSiS->LoadCRT2Palette = SiS301LoadPalette; + pSiS->SetThreshold = SiS630Threshold; + break; + case PCI_CHIP_SIS300: + pSiS->MaxClock = SiSMemBandWidth(pScrn); + pSiS->SiSSave = SiS300Save; + pSiS->SiSSave2 = SiS301Save; + pSiS->SiSSaveLVDS = SiSLVDSSave; + pSiS->SiSSaveChrontel = SiSChrontelSave; + pSiS->SiSRestore = SiS300Restore; + pSiS->SiSRestore2 = SiS301Restore; + pSiS->SiSRestoreLVDS = SiSLVDSRestore; + pSiS->SiSRestoreChrontel= SiSChrontelRestore; + pSiS->LoadCRT2Palette = SiS301LoadPalette; + pSiS->SetThreshold = SiS300Threshold; + break; + case PCI_CHIP_SIS530: + pSiS->MaxClock = SiSMemBandWidth(pScrn); + pSiS->SiSRestore = SiSRestore; + pSiS->SiSSave = SiSSave; + pSiS->SetThreshold = SiS530Threshold; + break; + case PCI_CHIP_SIS6326: + pSiS->MaxClock = SiSMemBandWidth(pScrn); + pSiS->SiSRestore = SiSRestore; + pSiS->SiSSave = SiSSave; + pSiS->SetThreshold = SiSThreshold; + break; + default: + pSiS->MaxClock = SiSMemBandWidth(pScrn); + pSiS->SiSRestore = SiSRestore; + pSiS->SiSSave = SiSSave; + pSiS->SetThreshold = SiSThreshold; + } } -void +static void SetBlock(CARD16 port, CARD8 from, CARD8 to, CARD8 *DataPtr) { - CARD8 index; + CARD8 index; - for (index=from; index <= to; index++, DataPtr++) { - outSISIDXREG(port, index, *DataPtr); - } + for (index=from; index <= to; index++, DataPtr++) { + outSISIDXREG(port, index, *DataPtr); + } } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h new file mode 100644 index 000000000..0faf237bd --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h @@ -0,0 +1,14 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h,v 1.2 2001/04/19 14:11:37 alanh Exp $ */ +int compute_vclk(int Clock, int *out_n, int *out_dn, int *out_div, + int *out_sbit, int *out_scale); +void SISDACPreInit(ScrnInfoPtr pScrn); +unsigned int SiSddc1Read(ScrnInfoPtr pScrn); +void SISLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, + LOCO *colors, VisualPtr pVisual); +void SiSCalcClock(ScrnInfoPtr pScrn, int clock, int max_VLD, + unsigned int *vclk); + +void SiSIODump(ScrnInfoPtr pScrn); +int SiSMemBandWidth(ScrnInfoPtr pScrn); +int SiSMclk(SISPtr pSiS); + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c index fe29521f0..f1f97640b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c @@ -21,7 +21,7 @@ * * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c,v 1.1 2000/06/26 10:26:15 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c,v 1.2 2001/04/19 12:40:33 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -34,8 +34,9 @@ #include "sis_regs.h" #include "dgaproc.h" +Bool SISDGAInit(ScreenPtr pScreen); static Bool SIS_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, - int *, int *, int *); + int *, int *, int *); static Bool SIS_SetMode(ScrnInfoPtr, DGAModePtr); static void SIS_Sync(ScrnInfoPtr); static int SIS_GetViewport(ScrnInfoPtr); @@ -43,7 +44,7 @@ static void SIS_SetViewport(ScrnInfoPtr, int, int, int); static void SIS_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); static void SIS_BlitRect(ScrnInfoPtr, int, int, int, int, int, int); static void SIS_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, - unsigned long); + unsigned long); static DGAFunctionRec SISDGAFuncs = { @@ -56,7 +57,7 @@ DGAFunctionRec SISDGAFuncs = { SIS_FillRect, SIS_BlitRect, #if 0 - SIS_BlitTransRect + SIS_BlitTransRect, #else NULL #endif @@ -77,77 +78,79 @@ SISDGAInit(ScreenPtr pScreen) while(pMode) { - if(0 /*pScrn->displayWidth != pMode->HDisplay*/) { - newmodes = xrealloc(modes, (num + 2) * sizeof(DGAModeRec)); - oneMore = TRUE; - } else { - newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec)); - oneMore = FALSE; - } +#if 0 + if(pScrn->displayWidth != pMode->HDisplay) { + newmodes = xrealloc(modes, (num + 2) * sizeof(DGAModeRec)); + oneMore = TRUE; + } else { +#endif + newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec)); + oneMore = FALSE; + /* } */ - if(!newmodes) { - xfree(modes); - return FALSE; - } - modes = newmodes; + if(!newmodes) { + xfree(modes); + return FALSE; + } + modes = newmodes; SECOND_PASS: - currentMode = modes + num; - num++; - - currentMode->mode = pMode; - currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; - currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; - if(pMode->Flags & V_DBLSCAN) - currentMode->flags |= DGA_DOUBLESCAN; - if(pMode->Flags & V_INTERLACE) - currentMode->flags |= DGA_INTERLACED; - currentMode->byteOrder = pScrn->imageByteOrder; - currentMode->depth = pScrn->depth; - currentMode->bitsPerPixel = pScrn->bitsPerPixel; - currentMode->red_mask = pScrn->mask.red; - currentMode->green_mask = pScrn->mask.green; - currentMode->blue_mask = pScrn->mask.blue; - currentMode->visualClass = (Bpp == 1) ? PseudoColor : TrueColor; - currentMode->viewportWidth = pMode->HDisplay; - currentMode->viewportHeight = pMode->VDisplay; - currentMode->xViewportStep = 1; - currentMode->yViewportStep = 1; - currentMode->viewportFlags = DGA_FLIP_RETRACE; - currentMode->offset = 0; - currentMode->address = pSIS->FbBase; - - if(oneMore) { /* first one is narrow width */ - currentMode->bytesPerScanline = ((pMode->HDisplay * Bpp) + 3) & ~3L; - currentMode->imageWidth = pMode->HDisplay; - currentMode->imageHeight = pMode->VDisplay; - currentMode->pixmapWidth = currentMode->imageWidth; - currentMode->pixmapHeight = currentMode->imageHeight; - currentMode->maxViewportX = currentMode->imageWidth - - currentMode->viewportWidth; - /* this might need to get clamped to some maximum */ - currentMode->maxViewportY = currentMode->imageHeight - - currentMode->viewportHeight; - oneMore = FALSE; - goto SECOND_PASS; - } else { - currentMode->bytesPerScanline = - ((pScrn->displayWidth * Bpp) + 3) & ~3L; - currentMode->imageWidth = pScrn->displayWidth; - currentMode->imageHeight = pMode->VDisplay; - currentMode->pixmapWidth = currentMode->imageWidth; - currentMode->pixmapHeight = currentMode->imageHeight; - currentMode->maxViewportX = currentMode->imageWidth - - currentMode->viewportWidth; - /* this might need to get clamped to some maximum */ - currentMode->maxViewportY = currentMode->imageHeight - - currentMode->viewportHeight; - } - - pMode = pMode->next; - if(pMode == firstMode) - break; + currentMode = modes + num; + num++; + + currentMode->mode = pMode; + currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; + currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; + if(pMode->Flags & V_DBLSCAN) + currentMode->flags |= DGA_DOUBLESCAN; + if(pMode->Flags & V_INTERLACE) + currentMode->flags |= DGA_INTERLACED; + currentMode->byteOrder = pScrn->imageByteOrder; + currentMode->depth = pScrn->depth; + currentMode->bitsPerPixel = pScrn->bitsPerPixel; + currentMode->red_mask = pScrn->mask.red; + currentMode->green_mask = pScrn->mask.green; + currentMode->blue_mask = pScrn->mask.blue; + currentMode->visualClass = (Bpp == 1) ? PseudoColor : TrueColor; + currentMode->viewportWidth = pMode->HDisplay; + currentMode->viewportHeight = pMode->VDisplay; + currentMode->xViewportStep = 1; + currentMode->yViewportStep = 1; + currentMode->viewportFlags = DGA_FLIP_RETRACE; + currentMode->offset = 0; + currentMode->address = pSIS->FbBase; + + if(oneMore) { /* first one is narrow width */ + currentMode->bytesPerScanline = ((pMode->HDisplay * Bpp) + 3) & ~3L; + currentMode->imageWidth = pMode->HDisplay; + currentMode->imageHeight = pMode->VDisplay; + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = currentMode->imageHeight; + currentMode->maxViewportX = currentMode->imageWidth - + currentMode->viewportWidth; + /* this might need to get clamped to some maximum */ + currentMode->maxViewportY = currentMode->imageHeight - + currentMode->viewportHeight; + oneMore = FALSE; + goto SECOND_PASS; + } else { + currentMode->bytesPerScanline = + ((pScrn->displayWidth * Bpp) + 3) & ~3L; + currentMode->imageWidth = pScrn->displayWidth; + currentMode->imageHeight = pMode->VDisplay; + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = currentMode->imageHeight; + currentMode->maxViewportX = currentMode->imageWidth - + currentMode->viewportWidth; + /* this might need to get clamped to some maximum */ + currentMode->maxViewportY = currentMode->imageHeight - + currentMode->viewportHeight; + } + + pMode = pMode->next; + if(pMode == firstMode) + break; } pSIS->numDGAModes = num; @@ -166,27 +169,25 @@ SIS_SetMode( int index = pScrn->pScreen->myNum; SISPtr pSIS = SISPTR(pScrn); - if(!pMode) { /* restore the original mode */ - /* put the ScreenParameters back */ - - pScrn->displayWidth = OldDisplayWidth[index]; - - SISSwitchMode(index, pScrn->currentMode, 0); - pSIS->DGAactive = FALSE; - } else { - if(!pSIS->DGAactive) { /* save the old parameters */ - OldDisplayWidth[index] = pScrn->displayWidth; + if(!pMode) { /* restore the original mode */ + /* put the ScreenParameters back */ + pScrn->displayWidth = OldDisplayWidth[index]; + + (*pScrn->SwitchMode)(index, pScrn->currentMode, 0); + pSIS->DGAactive = FALSE; + } else { + if(!pSIS->DGAactive) { /* save the old parameters */ + OldDisplayWidth[index] = pScrn->displayWidth; - pSIS->DGAactive = TRUE; - } + pSIS->DGAactive = TRUE; + } - pScrn->displayWidth = pMode->bytesPerScanline / - (pMode->bitsPerPixel >> 3); + pScrn->displayWidth = pMode->bytesPerScanline / + (pMode->bitsPerPixel >> 3); - SISSwitchMode(index, pMode->mode, 0); - } - - return TRUE; + (*pScrn->SwitchMode)(index, pMode->mode, 0); + } + return TRUE; } static int @@ -206,7 +207,7 @@ SIS_SetViewport( ){ SISPtr pSIS = SISPTR(pScrn); - SISAdjustFrame(pScrn->pScreen->myNum, x, y, flags); + (*pScrn->AdjustFrame)(pScrn->pScreen->myNum, x, y, flags); pSIS->DGAViewportStatus = 0; /* SISAdjustFrame loops until finished */ } @@ -219,9 +220,9 @@ SIS_FillRect ( SISPtr pSIS = SISPTR(pScrn); if(pSIS->AccelInfoPtr) { - (*pSIS->AccelInfoPtr->SetupForSolidFill)(pScrn, color, GXcopy, ~0); - (*pSIS->AccelInfoPtr->SubsequentSolidFillRect)(pScrn, x, y, w, h); - SET_SYNC_FLAG(pSIS->AccelInfoPtr); + (*pSIS->AccelInfoPtr->SetupForSolidFill)(pScrn, color, GXcopy, ~0); + (*pSIS->AccelInfoPtr->SubsequentSolidFillRect)(pScrn, x, y, w, h); + SET_SYNC_FLAG(pSIS->AccelInfoPtr); } } @@ -232,7 +233,7 @@ SIS_Sync( SISPtr pSIS = SISPTR(pScrn); if(pSIS->AccelInfoPtr) { - (*pSIS->AccelInfoPtr->Sync)(pScrn); + (*pSIS->AccelInfoPtr->Sync)(pScrn); } } @@ -246,14 +247,14 @@ SIS_BlitRect( SISPtr pSIS = SISPTR(pScrn); if(pSIS->AccelInfoPtr) { - int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; - int ydir = (srcy < dsty) ? -1 : 1; - - (*pSIS->AccelInfoPtr->SetupForScreenToScreenCopy)( - pScrn, xdir, ydir, GXcopy, ~0, -1); - (*pSIS->AccelInfoPtr->SubsequentScreenToScreenCopy)( - pScrn, srcx, srcy, dstx, dsty, w, h); - SET_SYNC_FLAG(pSIS->AccelInfoPtr); + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; + + (*pSIS->AccelInfoPtr->SetupForScreenToScreenCopy)( + pScrn, xdir, ydir, GXcopy, ~0, -1); + (*pSIS->AccelInfoPtr->SubsequentScreenToScreenCopy)( + pScrn, srcx, srcy, dstx, dsty, w, h); + SET_SYNC_FLAG(pSIS->AccelInfoPtr); } } @@ -282,7 +283,7 @@ SIS_OpenFramebuffer( ){ SISPtr pSIS = SISPTR(pScrn); - *name = NULL; /* no special device */ + *name = NULL; /* no special device */ *mem = (unsigned char*)pSIS->FbAddress; *size = pSIS->FbMapSize; *offset = 0; 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 32aa40415..3dcdfb7c5 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.10 2001/03/21 17:02:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.12 2001/04/19 12:40:33 alanh Exp $ */ /* modified from tdfx_dri.c, mga_dri.c */ @@ -11,14 +11,18 @@ #include "xf86Pci.h" #include "fb.h" -#include "miline.h" - #include "GL/glxtokens.h" #include "sis.h" #include "sis_dri.h" -#include "sis300_accel.h" +#define BR(x) (0x8200 | (x) << 2) +#define SiSIdle \ + while((MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ + while((MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ + MMIO_IN16(pSiS->IOBase, 0x8240); + +extern Bool drmSiSAgpInit(int driSubFD, int offset, int size); extern void GlxSetVisualConfigs( int nconfigs, @@ -37,18 +41,18 @@ static char SISClientDriverName[] = "sis"; static Bool SISInitVisualConfigs(ScreenPtr pScreen); static Bool SISCreateContext(ScreenPtr pScreen, VisualPtr visual, - drmContext hwContext, void *pVisualConfigPriv, - DRIContextType contextStore); + drmContext hwContext, void *pVisualConfigPriv, + DRIContextType contextStore); static void SISDestroyContext(ScreenPtr pScreen, drmContext hwContext, - DRIContextType contextStore); + DRIContextType contextStore); static void SISDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, - DRIContextType readContextType, - void *readContextStore, - DRIContextType writeContextType, - void *writeContextStore); + DRIContextType readContextType, + void *readContextStore, + DRIContextType writeContextType, + void *writeContextStore); static void SISDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); static void SISDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, - RegionPtr prgnSrc, CARD32 index); + RegionPtr prgnSrc, CARD32 index); void SISLostContext(ScreenPtr pScreen); @@ -77,16 +81,16 @@ SISInitVisualConfigs(ScreenPtr pScreen) numConfigs = (useZ16)?8:16; if (!(pConfigs = (__GLXvisualConfig*)xnfcalloc(sizeof(__GLXvisualConfig), - numConfigs))) { + numConfigs))) { return FALSE; } if (!(pSISConfigs = (SISConfigPrivPtr)xnfcalloc(sizeof(SISConfigPrivRec), - numConfigs))) { + numConfigs))) { xfree(pConfigs); return FALSE; } if (!(pSISConfigPtrs = (SISConfigPrivPtr*)xnfcalloc(sizeof(SISConfigPrivPtr), - numConfigs))) { + numConfigs))) { xfree(pConfigs); xfree(pSISConfigs); return FALSE; @@ -194,9 +198,9 @@ Bool SISDRIScreenInit(ScreenPtr pScreen) { int major, minor, patch; DRIQueryVersion(&major, &minor, &patch); - if (major != 4 || minor < 0) { + if (major != 3 || minor != 1 || patch < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] SISDRIScreenInit failed (DRI version = %d.%d.%d, expected 4.0.x). Disabling DRI.\n", + "[drm] SISDRIScreenInit failed (DRI version = %d.%d.%d, expected 3.1.x). Disabling DRI.\n", major, minor, patch); return FALSE; } @@ -210,9 +214,9 @@ Bool SISDRIScreenInit(ScreenPtr pScreen) pDRIInfo->clientDriverName = SISClientDriverName; pDRIInfo->busIdString = xalloc(64); sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d", - ((pciConfigPtr)pSIS->PciInfo->thisCard)->busnum, - ((pciConfigPtr)pSIS->PciInfo->thisCard)->devnum, - ((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum); + ((pciConfigPtr)pSIS->PciInfo->thisCard)->busnum, + ((pciConfigPtr)pSIS->PciInfo->thisCard)->devnum, + ((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum); pDRIInfo->ddxDriverMajorVersion = 0; pDRIInfo->ddxDriverMinorVersion = 1; pDRIInfo->ddxDriverPatchVersion = 0; @@ -239,7 +243,7 @@ Bool SISDRIScreenInit(ScreenPtr pScreen) /* For now the mapping works by using a fixed size defined * in the SAREA header */ - if (sizeof(XF86DRISAREARec)+sizeof(SISSAREAPriv)>SAREA_MAX) { + if (sizeof(XF86DRISAREARec)+sizeof(SISSAREAPriv) > SAREA_MAX) { ErrorF("Data does not fit in SAREA\n"); return FALSE; } @@ -262,9 +266,6 @@ Bool SISDRIScreenInit(ScreenPtr pScreen) pDRIInfo->MoveBuffers = SISDRIMoveBuffers; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; - pDRIInfo->createDummyCtx = TRUE; - pDRIInfo->createDummyCtxPriv = FALSE; - if (!DRIScreenInit(pScreen, pDRIInfo, &pSIS->drmSubFD)) { xfree(pDRIInfo->devPrivate); pDRIInfo->devPrivate=0; @@ -277,15 +278,15 @@ Bool SISDRIScreenInit(ScreenPtr pScreen) pSISDRI->regs.size = SISIOMAPSIZE; pSISDRI->regs.map = 0; if (drmAddMap(pSIS->drmSubFD, (drmHandle)pSIS->IOAddress, - pSISDRI->regs.size, DRM_REGISTERS, 0, - &pSISDRI->regs.handle)<0) + pSISDRI->regs.size, DRM_REGISTERS, 0, + &pSISDRI->regs.handle)<0) { SISDRICloseScreen(pScreen); return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08lx\n", - pSISDRI->regs.handle); + pSISDRI->regs.handle); /* AGP */ do{ @@ -350,15 +351,15 @@ Bool SISDRIScreenInit(ScreenPtr pScreen) /* enable IRQ */ pSIS->irq = drmGetInterruptFromBusID(pSIS->drmSubFD, - ((pciConfigPtr)pSIS->PciInfo->thisCard)->busnum, - ((pciConfigPtr)pSIS->PciInfo->thisCard)->devnum, - ((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum); + ((pciConfigPtr)pSIS->PciInfo->thisCard)->busnum, + ((pciConfigPtr)pSIS->PciInfo->thisCard)->devnum, + ((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum); if((drmCtlInstHandler(pSIS->drmSubFD, pSIS->irq)) != 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] failure adding irq %d handler, stereo disabled\n", - pSIS->irq); + "[drm] failure adding irq %d handler, stereo disabled\n", + pSIS->irq); pSIS->irqEnabled = FALSE; } else @@ -409,15 +410,15 @@ SISDRICloseScreen(ScreenPtr pScreen) */ static Bool SISCreateContext(ScreenPtr pScreen, VisualPtr visual, - drmContext hwContext, void *pVisualConfigPriv, - DRIContextType contextStore) + drmContext hwContext, void *pVisualConfigPriv, + DRIContextType contextStore) { return TRUE; } static void SISDestroyContext(ScreenPtr pScreen, drmContext hwContext, - DRIContextType contextStore) + DRIContextType contextStore) { } @@ -473,8 +474,8 @@ SISDRIFinishScreenInit(ScreenPtr pScreen) static void SISDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, - DRIContextType oldContextType, void *oldContext, - DRIContextType newContextType, void *newContext) + DRIContextType oldContextType, void *oldContext, + DRIContextType newContextType, void *newContext) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSIS = SISPTR(pScrn); @@ -512,7 +513,7 @@ SISDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index) static void SISDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, - RegionPtr prgnSrc, CARD32 index) + RegionPtr prgnSrc, CARD32 index) { ScreenPtr pScreen = pParent->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h index 75e4646db..5aa2edb66 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h,v 1.3 2001/03/03 22:26:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h,v 1.5 2001/04/20 02:53:59 tsi Exp $ */ /* modified from tdfx_dri.h */ @@ -57,4 +57,14 @@ typedef struct { int dummy; } SISDRIContextRec, *SISDRIContextPtr; +#ifdef XFree86Server + +#include "screenint.h" + +Bool SISDRIScreenInit(ScreenPtr pScreen); +void SISDRICloseScreen(ScreenPtr pScreen); +Bool SISDRIFinishScreenInit(ScreenPtr pScreen); + +#endif + #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c index c4deecbed..4c07baa7d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c @@ -25,8 +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.59 2001/03/06 17:07:40 dawes Exp $ */ - +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.61 2001/04/19 14:05:55 alanh Exp $ */ #include "fb.h" #include "xf1bpp.h" @@ -43,14 +42,19 @@ #include "xf86cmap.h" #include "vgaHW.h" #include "xf86RAC.h" +#include "shadowfb.h" -#include "mipointer.h" +#include "sis_shadow.h" + +#include "mipointer.h" #include "mibstore.h" #include "sis.h" #include "sis_regs.h" +#include "sis_bios.h" #include "sis_vb.h" +#include "sis_dac.h" #define _XF86DGA_SERVER_ #include "extensions/xf86dgastr.h" @@ -68,34 +72,50 @@ #include "dri.h" #endif -static void SISIdentify(int flags); -static Bool SISProbe(DriverPtr drv, int flags); -static Bool SISPreInit(ScrnInfoPtr pScrn, int flags); -static Bool SISScreenInit(int Index, ScreenPtr pScreen, int argc, - char **argv); -static Bool SISEnterVT(int scrnIndex, int flags); -static void SISLeaveVT(int scrnIndex, int flags); -static Bool SISCloseScreen(int scrnIndex, ScreenPtr pScreen); -static Bool SISSaveScreen(ScreenPtr pScreen, int mode); + +/* mandatory functions */ +static void SISIdentify(int flags); +static Bool SISProbe(DriverPtr drv, int flags); +static Bool SISPreInit(ScrnInfoPtr pScrn, int flags); +static Bool SISScreenInit(int Index, ScreenPtr pScreen, int argc, + char **argv); +static Bool SISEnterVT(int scrnIndex, int flags); +static void SISLeaveVT(int scrnIndex, int flags); +static Bool SISCloseScreen(int scrnIndex, ScreenPtr pScreen); +static Bool SISSaveScreen(ScreenPtr pScreen, int mode); +static Bool SISSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); +static void SISAdjustFrame(int scrnIndex, int x, int y, int flags); /* Optional functions */ -static void SISFreeScreen(int scrnIndex, int flags); -static int SISValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, - int flags); +static void SISFreeScreen(int scrnIndex, int flags); +static int SISValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, + int flags); /* Internally used functions */ -static Bool SISMapMem(ScrnInfoPtr pScrn); -static Bool SISUnmapMem(ScrnInfoPtr pScrn); -static void SISSave(ScrnInfoPtr pScrn); -static void SISRestore(ScrnInfoPtr pScrn); -static Bool SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); -static void SISModifyModeInfo(DisplayModePtr mode); +static Bool SISMapMem(ScrnInfoPtr pScrn); +static Bool SISUnmapMem(ScrnInfoPtr pScrn); +static void SISSave(ScrnInfoPtr pScrn); +static void SISRestore(ScrnInfoPtr pScrn); +static Bool SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); +static void SISModifyModeInfo(DisplayModePtr mode); +static void SiSPreSetMode(ScrnInfoPtr pScrn); + +void SiSOptions(ScrnInfoPtr pScrn); +OptionInfoPtr SISAvailableOptions(int chipid, int busid); +void SiSSetup(ScrnInfoPtr pScrn); +void SISVGAPreInit(ScrnInfoPtr pScrn); +Bool SiSAccelInit(ScreenPtr pScreen); +Bool SiS300AccelInit(ScreenPtr pScreen); +Bool SiS530AccelInit(ScreenPtr pScreen); +Bool SiSHWCursorInit(ScreenPtr pScreen); +Bool SISDGAInit(ScreenPtr pScreen); +void SISInitVideo(ScreenPtr pScreen); + #ifdef DEBUG -static void SiSDumpModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode); +static void SiSDumpModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode); #endif - /* * This is intentionally screen-independent. It indicates the binding * choice made in the first PreInit. @@ -123,46 +143,46 @@ DriverRec SIS = { static SymTabRec SISChipsets[] = { #if 0 - { PCI_CHIP_SG86C201, "SIS86c201" }, - { PCI_CHIP_SG86C202, "SIS86c202" }, - { PCI_CHIP_SG86C205, "SIS86c205" }, - { PCI_CHIP_SG86C215, "SIS86c215" }, - { PCI_CHIP_SG86C225, "SIS86c225" }, + { PCI_CHIP_SG86C201, "SIS86c201" }, + { PCI_CHIP_SG86C202, "SIS86c202" }, + { PCI_CHIP_SG86C205, "SIS86c205" }, + { PCI_CHIP_SG86C215, "SIS86c215" }, + { PCI_CHIP_SG86C225, "SIS86c225" }, #endif - { PCI_CHIP_SIS5597, "SIS5597" }, - { PCI_CHIP_SIS5597, "SIS5598" }, - { PCI_CHIP_SIS530, "SIS530" }, - { PCI_CHIP_SIS6326, "SIS6326" }, - { PCI_CHIP_SIS300, "SIS300" }, - { PCI_CHIP_SIS630, "SIS630" }, - { PCI_CHIP_SIS540, "SIS540" }, - { -1, NULL } + { PCI_CHIP_SIS5597, "SIS5597" }, + { PCI_CHIP_SIS5597, "SIS5598" }, + { PCI_CHIP_SIS530, "SIS530" }, + { PCI_CHIP_SIS6326, "SIS6326" }, + { PCI_CHIP_SIS300, "SIS300" }, + { PCI_CHIP_SIS630, "SIS630" }, + { PCI_CHIP_SIS540, "SIS540" }, + { -1, NULL } }; static PciChipsets SISPciChipsets[] = { #if 0 - { PCI_CHIP_SG86C201, PCI_CHIP_SG86C201, RES_SHARED_VGA }, - { PCI_CHIP_SG86C202, PCI_CHIP_SG86C202, RES_SHARED_VGA }, - { PCI_CHIP_SG86C205, PCI_CHIP_SG86C205, RES_SHARED_VGA }, - { PCI_CHIP_SG86C205, PCI_CHIP_SG86C205, RES_SHARED_VGA }, + { PCI_CHIP_SG86C201, PCI_CHIP_SG86C201, RES_SHARED_VGA }, + { PCI_CHIP_SG86C202, PCI_CHIP_SG86C202, RES_SHARED_VGA }, + { PCI_CHIP_SG86C205, PCI_CHIP_SG86C205, RES_SHARED_VGA }, + { PCI_CHIP_SG86C205, PCI_CHIP_SG86C205, RES_SHARED_VGA }, #endif - { PCI_CHIP_SIS5597, PCI_CHIP_SIS5597, RES_SHARED_VGA }, - { PCI_CHIP_SIS530, PCI_CHIP_SIS530, RES_SHARED_VGA }, - { PCI_CHIP_SIS6326, PCI_CHIP_SIS6326, RES_SHARED_VGA }, - { PCI_CHIP_SIS300, PCI_CHIP_SIS300, RES_SHARED_VGA }, - { PCI_CHIP_SIS630, PCI_CHIP_SIS630, RES_SHARED_VGA }, - { PCI_CHIP_SIS540, PCI_CHIP_SIS540, RES_SHARED_VGA }, - { -1, -1, RES_UNDEFINED } + { PCI_CHIP_SIS5597, PCI_CHIP_SIS5597, RES_SHARED_VGA }, + { PCI_CHIP_SIS530, PCI_CHIP_SIS530, RES_SHARED_VGA }, + { PCI_CHIP_SIS6326, PCI_CHIP_SIS6326, RES_SHARED_VGA }, + { PCI_CHIP_SIS300, PCI_CHIP_SIS300, RES_SHARED_VGA }, + { PCI_CHIP_SIS630, PCI_CHIP_SIS630, RES_SHARED_VGA }, + { PCI_CHIP_SIS540, PCI_CHIP_SIS540, RES_SHARED_VGA }, + { -1, -1, RES_UNDEFINED } }; int sisReg32MMIO[]={0x8280,0x8284,0x8288,0x828C,0x8290,0x8294,0x8298,0x829C, - 0x82A0,0x82A4,0x82A8,0x82AC}; + 0x82A0,0x82A4,0x82A8,0x82AC}; /* Engine Register for the 2nd Generation Graphics Engine */ int sis2Reg32MMIO[]={0x8200,0x8204,0x8208,0x820C,0x8210,0x8214,0x8218,0x821C, - 0x8220,0x8224,0x8228,0x822C,0x8230,0x8234,0x8238,0x823C, - 0x8240, 0x8300}; + 0x8220,0x8224,0x8228,0x822C,0x8230,0x8234,0x8238,0x823C, + 0x8240, 0x8300}; static const char *xaaSymbols[] = { "XAADestroyInfoRec", @@ -174,6 +194,7 @@ static const char *xaaSymbols[] = { "XAAScreenIndex", "XAACopyROP", "XAAHelpPatternROP", + "XAAFillSolidRects", NULL }; @@ -199,6 +220,12 @@ static const char *fbSymbols[] = { NULL }; +static const char *shadowSymbols[] = { + "ShadowFBInit", + NULL +}; + + static const char *ddcSymbols[] = { "xf86PrintEDID", "xf86DoEDID_DDC1", @@ -253,22 +280,23 @@ static const char *driSymbols[] = { }; #endif + #ifdef XFree86LOADER static MODULESETUPPROTO(sisSetup); static XF86ModuleVersionInfo sisVersRec = { - "sis", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XF86_VERSION_CURRENT, - SIS_MAJOR_VERSION, SIS_MINOR_VERSION, SIS_PATCHLEVEL, - ABI_CLASS_VIDEODRV, /* This is a video driver */ - ABI_VIDEODRV_VERSION, - MOD_CLASS_VIDEODRV, - {0,0,0,0} + SIS_DRIVER_NAME, + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + SIS_MAJOR_VERSION, SIS_MINOR_VERSION, SIS_PATCHLEVEL, + ABI_CLASS_VIDEODRV, /* This is a video driver */ + ABI_VIDEODRV_VERSION, + MOD_CLASS_VIDEODRV, + {0,0,0,0} }; XF86ModuleData sisModuleData = { &sisVersRec, sisSetup, NULL }; @@ -282,10 +310,11 @@ sisSetup(pointer module, pointer opts, int *errmaj, int *errmin) setupDone = TRUE; xf86AddDriver(&SIS, module, 0); LoaderRefSymLists(vgahwSymbols, fbSymbols, i2cSymbols, xaaSymbols, + shadowSymbols, #ifdef XF86DRI - drmSymbols, driSymbols, + drmSymbols, driSymbols, #endif - NULL); + NULL); return (pointer)TRUE; } @@ -324,18 +353,18 @@ SISFreeRec(ScrnInfoPtr pScrn) static void SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) { - unsigned char extDDC_PCR; - unsigned char crtc17 = 0; - unsigned char seq1 = 0 ; - int vgaIOBase = VGAHWPTR(pScrn)->IOBase; - - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,"SISDisplayPowerManagementSet(%d)\n",PowerManagementMode); - outb(vgaIOBase + 4, 0x17); - crtc17 = inb(vgaIOBase + 5); - outb(VGA_SEQ_INDEX, 0x11); - extDDC_PCR = inb(VGA_SEQ_DATA) & ~0xC0; - switch (PowerManagementMode) - { + unsigned char extDDC_PCR; + unsigned char crtc17 = 0; + unsigned char seq1 = 0 ; + int vgaIOBase = VGAHWPTR(pScrn)->IOBase; + + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,"SISDisplayPowerManagementSet(%d)\n",PowerManagementMode); + outb(vgaIOBase + 4, 0x17); + crtc17 = inb(vgaIOBase + 5); + outb(VGA_SEQ_INDEX, 0x11); + extDDC_PCR = inb(VGA_SEQ_DATA) & ~0xC0; + switch (PowerManagementMode) + { case DPMSModeOn: /* HSync: On, VSync: On */ seq1 = 0x00 ; @@ -359,46 +388,40 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla /* need same as the generic VGA function */ crtc17 &= ~0x80; break; - } - outw(VGA_SEQ_INDEX, 0x0100); /* Synchronous Reset */ - outb(VGA_SEQ_INDEX, 0x01); /* Select SEQ1 */ - seq1 |= inb(VGA_SEQ_DATA) & ~0x20; - outb(VGA_SEQ_DATA, seq1); - usleep(10000); - outb(vgaIOBase + 4, 0x17); - outb(vgaIOBase + 5, crtc17); - outb(VGA_SEQ_INDEX, 0x11); - outb(VGA_SEQ_DATA, extDDC_PCR); - outw(VGA_SEQ_INDEX, 0x0300); /* End Reset */ + } + outw(VGA_SEQ_INDEX, 0x0100); /* Synchronous Reset */ + outb(VGA_SEQ_INDEX, 0x01); /* Select SEQ1 */ + seq1 |= inb(VGA_SEQ_DATA) & ~0x20; + outb(VGA_SEQ_DATA, seq1); + usleep(10000); + outb(vgaIOBase + 4, 0x17); + outb(vgaIOBase + 5, crtc17); + outb(VGA_SEQ_INDEX, 0x11); + outb(VGA_SEQ_DATA, extDDC_PCR); + outw(VGA_SEQ_INDEX, 0x0300); /* End Reset */ } + /* Mandatory */ static void SISIdentify(int flags) { - xf86PrintChipsets(SIS_NAME, "driver for SiS chipsets", SISChipsets); + xf86PrintChipsets(SIS_NAME, "driver for SiS chipsets", SISChipsets); } static void -SIS1bppColorMap(ScrnInfoPtr pScrn) { -/* In 1 bpp we have color 0 at LUT 0 and color 1 at LUT 0x3f. - This makes white and black look right (otherwise they were both - black. I'm sure there's a better way to do that, just lazy to - search the docs. */ - +SIS1bppColorMap(ScrnInfoPtr pScrn) +{ SISPtr pSiS = SISPTR(pScrn); - /*outb(0x3C8, 0x00); outb(0x3C9, 0x00); outb(0x3C9, 0x00); outb(0x3C9, 0x00); - outb(0x3C8, 0x3F); outb(0x3C9, 0x3F); outb(0x3C9, 0x3F); outb(0x3C9, 0x3F);*/ - - outb(pSiS->RelIO+0x48, 0x00); - outb(pSiS->RelIO+0x49, 0x00); - outb(pSiS->RelIO+0x49, 0x00); + outb(pSiS->RelIO+0x48, 0x00); + outb(pSiS->RelIO+0x49, 0x00); + outb(pSiS->RelIO+0x49, 0x00); outb(pSiS->RelIO+0x49, 0x00); - - outb(pSiS->RelIO+0x48, 0x3F); - outb(pSiS->RelIO+0x49, 0x3F); - outb(pSiS->RelIO+0x49, 0x3F); + + outb(pSiS->RelIO+0x48, 0x3F); + outb(pSiS->RelIO+0x49, 0x3F); + outb(pSiS->RelIO+0x49, 0x3F); outb(pSiS->RelIO+0x49, 0x3F); } @@ -436,7 +459,7 @@ SISProbe(DriverPtr drv, int flags) */ if ((numDevSections = xf86MatchDevice(SIS_DRIVER_NAME, - &devSections)) <= 0) { + &devSections)) <= 0) { /* * There's no matching device section in the config file, so quit * now. @@ -468,8 +491,8 @@ SISProbe(DriverPtr drv, int flags) } numUsed = xf86MatchPciInstances(SIS_NAME, PCI_VENDOR_SIS, - SISChipsets, SISPciChipsets, devSections, - numDevSections, drv, &usedChips); + SISChipsets, SISPciChipsets, devSections, + numDevSections, drv, &usedChips); /* Free it since we don't need that list after this */ xfree(devSections); @@ -485,8 +508,8 @@ SISProbe(DriverPtr drv, int flags) pScrn = NULL; if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], - SISPciChipsets, NULL, NULL, - NULL, NULL, NULL))) { + SISPciChipsets, NULL, NULL, + NULL, NULL, NULL))) { /* Fill in what we can of the ScrnInfoRec */ pScrn->driverVersion = SIS_CURRENT_VERSION; pScrn->driverName = SIS_DRIVER_NAME; @@ -536,7 +559,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) const char *Sym = NULL; int pix24flags; - if (flags & PROBE_DETECT) return FALSE; + if (flags & PROBE_DETECT) + return FALSE; /* * Note: This function is only called once at server startup, and @@ -567,7 +591,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) if (!vgaHWGetHWRec(pScrn)) return FALSE; - VGAHWPTR(pScrn)->MapSize = 0x10000; /* Standard 64k VGA window */ + VGAHWPTR(pScrn)->MapSize = 0x10000; /* Standard 64k VGA window */ if (!vgaHWMapMem(pScrn)) return FALSE; @@ -589,17 +613,17 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* Find the PCI info for this screen */ pSiS->PciInfo = xf86GetPciInfoForEntity(pSiS->pEnt->index); pSiS->PciTag = pciTag(pSiS->PciInfo->bus, pSiS->PciInfo->device, - pSiS->PciInfo->func); + pSiS->PciInfo->func); /* * XXX This could be refined if some VGA memory resources are not * decoded in operating mode. */ { - resRange vgamem[] = { {ResShrMemBlock,0xA0000,0xAFFFF}, - {ResShrMemBlock,0xB0000,0xB7FFF}, - {ResShrMemBlock,0xB8000,0xBFFFF}, - _END }; + resRange vgamem[] = { {ResShrMemBlock,0xA0000,0xAFFFF}, + {ResShrMemBlock,0xB0000,0xB7FFF}, + {ResShrMemBlock,0xB8000,0xBFFFF}, + _END }; xf86SetOperatingState(vgamem, pSiS->pEnt->index, ResUnusedOpr); } @@ -616,31 +640,75 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pScrn->monitor = pScrn->confScreen->monitor; /* + * Set the Chipset and ChipRev, allowing config file entries to + * override. + */ + if (pSiS->pEnt->device->chipset && *pSiS->pEnt->device->chipset) { + pScrn->chipset = pSiS->pEnt->device->chipset; + pSiS->Chipset = xf86StringToToken(SISChipsets, pScrn->chipset); + from = X_CONFIG; + } else if (pSiS->pEnt->device->chipID >= 0) { + pSiS->Chipset = pSiS->pEnt->device->chipID; + pScrn->chipset = (char *)xf86TokenToString(SISChipsets, pSiS->Chipset); + + from = X_CONFIG; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipID override: 0x%04X\n", + pSiS->Chipset); + } else { + from = X_PROBED; + pSiS->Chipset = pSiS->PciInfo->chipType; + pScrn->chipset = (char *)xf86TokenToString(SISChipsets, pSiS->Chipset); + } + if (pSiS->pEnt->device->chipRev >= 0) { + pSiS->ChipRev = pSiS->pEnt->device->chipRev; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n", + pSiS->ChipRev); + } else { + pSiS->ChipRev = pSiS->PciInfo->chipRev; + } + + /* + * This shouldn't happen because such problems should be caught in + * SISProbe(), but check it just in case. + */ + if (pScrn->chipset == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "ChipID 0x%04X is not recognised\n", pSiS->Chipset); + return FALSE; + } + if (pSiS->Chipset < 0) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Chipset \"%s\" is not recognised\n", pScrn->chipset); + return FALSE; + } + + + /* * The first thing we should figure out is the depth, bpp, etc. * Our default depth is 8, so pass it to the helper function. * Our preference for depth 24 is 24bpp, so tell it that too. */ pix24flags = Support32bppFb | Support24bppFb | - SupportConvert24to32 | SupportConvert32to24 | - PreferConvert32to24; + SupportConvert24to32 | SupportConvert32to24; + if (pSiS->Chipset == PCI_CHIP_SIS6326) + pix24flags |= PreferConvert32to24; + + if (!xf86SetDepthBpp(pScrn, 8, 8, 8, pix24flags)) + return FALSE; - if (!xf86SetDepthBpp(pScrn, 8, 8, 8, pix24flags)) { + /* Check that the returned depth is one we support */ + switch (pScrn->depth) { + case 8: + case 15: + case 16: + case 24: + /* OK */ + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Given depth (%d) is not supported by this driver\n", + pScrn->depth); return FALSE; - } else { - /* Check that the returned depth is one we support */ - switch (pScrn->depth) { - case 8: - case 15: - case 16: - case 24: - /* OK */ - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Given depth (%d) is not supported by this driver\n", - pScrn->depth); - return FALSE; - } } xf86PrintDepthBpp(pScrn); @@ -661,7 +729,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } else { /* XXX check that weight returned is supported */ - ; + ; } } @@ -671,8 +739,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* We don't currently support DirectColor at > 8bpp */ if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual" - " (%s) is not supported at depth %d\n", - xf86GetVisualName(pScrn->defaultVisual), pScrn->depth); + " (%s) is not supported at depth %d\n", + xf86GetVisualName(pScrn->defaultVisual), pScrn->depth); return FALSE; } } @@ -697,53 +765,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pScrn->rgbBits = 6; } - - pSiS->ddc1Read = SiSddc1Read; /* this cap will be modified */ + pSiS->ddc1Read = SiSddc1Read; /* this cap will be modified */ from = X_DEFAULT; - /* - * Set the Chipset and ChipRev, allowing config file entries to - * override. - */ - if (pSiS->pEnt->device->chipset && *pSiS->pEnt->device->chipset) { - pScrn->chipset = pSiS->pEnt->device->chipset; - pSiS->Chipset = xf86StringToToken(SISChipsets, pScrn->chipset); - from = X_CONFIG; - } else if (pSiS->pEnt->device->chipID >= 0) { - pSiS->Chipset = pSiS->pEnt->device->chipID; - pScrn->chipset = (char *)xf86TokenToString(SISChipsets, pSiS->Chipset); - - from = X_CONFIG; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipID override: 0x%04X\n", - pSiS->Chipset); - } else { - from = X_PROBED; - pSiS->Chipset = pSiS->PciInfo->chipType; - pScrn->chipset = (char *)xf86TokenToString(SISChipsets, pSiS->Chipset); - } - if (pSiS->pEnt->device->chipRev >= 0) { - pSiS->ChipRev = pSiS->pEnt->device->chipRev; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n", - pSiS->ChipRev); - } else { - pSiS->ChipRev = pSiS->PciInfo->chipRev; - } - - /* - * This shouldn't happen because such problems should be caught in - * SISProbe(), but check it just in case. - */ - if (pScrn->chipset == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "ChipID 0x%04X is not recognised\n", pSiS->Chipset); - return FALSE; - } - if (pSiS->Chipset < 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Chipset \"%s\" is not recognised\n", pScrn->chipset); - return FALSE; - } - outb(VGA_SEQ_INDEX, 0x05); unlock = inb(VGA_SEQ_DATA); outw(VGA_SEQ_INDEX, 0x8605); /* Unlock registers */ @@ -775,7 +799,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n", - (unsigned long)pSiS->FbAddress); + (unsigned long)pSiS->FbAddress); if (pSiS->pEnt->device->IOBase != 0) { /* @@ -789,75 +813,81 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n", - (unsigned long)pSiS->IOAddress); + (unsigned long)pSiS->IOAddress); pSiS->RelIO = pSiS->PciInfo->ioBase[2] & 0xFFFC; xf86DrvMsg(pScrn->scrnIndex, from, "Relocate IO registers at 0x%lX\n", - (unsigned long)pSiS->RelIO); + (unsigned long)pSiS->RelIO); /* Register the PCI-assigned resources. */ if (xf86RegisterResources(pSiS->pEnt->index, NULL, ResExclusive)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "xf86RegisterResources() found resource conflicts\n"); + "xf86RegisterResources() found resource conflicts\n"); return FALSE; } from = X_PROBED; - if ((pSiS->pEnt->device->videoRam != 0) && - (pSiS->pEnt->device->videoRam < pScrn->videoRam)) { + if (pSiS->pEnt->device->videoRam != 0) { pScrn->videoRam = pSiS->pEnt->device->videoRam; from = X_CONFIG; } - xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte\n", + if ((pSiS->Chipset == PCI_CHIP_SIS6326) + && (pScrn->videoRam >= 8192) + && (from != X_CONFIG)) { + pScrn->videoRam = 4096; + xf86DrvMsg(pScrn->scrnIndex, from, "Limiting VideoRAM to %d KB\n", + pScrn->videoRam); + } else + xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d KB\n", pScrn->videoRam); pSiS->FbMapSize = pScrn->videoRam * 1024; - + SISVGAPreInit(pScrn); - SISLCDPreInit(pScrn); - SISTVPreInit(pScrn); + SISLCDPreInit(pScrn); + SISTVPreInit(pScrn); SISCRT2PreInit(pScrn); if (pSiS->ForceCRT2Type == CRT2_DEFAULT) - { if (pSiS->VBFlags & CRT2_VGA) - pSiS->ForceCRT2Type = CRT2_VGA; - else if (pSiS->VBFlags & CRT2_LCD) - pSiS->ForceCRT2Type = CRT2_LCD; - else if (pSiS->VBFlags & CRT2_TV) - pSiS->ForceCRT2Type = CRT2_TV; - } + { if (pSiS->VBFlags & CRT2_VGA) + pSiS->ForceCRT2Type = CRT2_VGA; + else if (pSiS->VBFlags & CRT2_LCD) + pSiS->ForceCRT2Type = CRT2_LCD; + else if (pSiS->VBFlags & CRT2_TV) + pSiS->ForceCRT2Type = CRT2_TV; + } switch (pSiS->ForceCRT2Type) - { case CRT2_TV: - pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_LCD | CRT2_VGA); - if (pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL)) - pSiS->VBFlags = pSiS->VBFlags | CRT2_TV; - else - pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_TV); - break; - case CRT2_LCD: - pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_TV | CRT2_VGA); - if (pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL)) - pSiS->VBFlags = pSiS->VBFlags | CRT2_LCD; - else - pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_LCD); - break; - case CRT2_VGA: - pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_TV | CRT2_LCD); - if (pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL)) - pSiS->VBFlags = pSiS->VBFlags | CRT2_VGA; - else - pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_VGA); - break; - } + { case CRT2_TV: + pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_LCD | CRT2_VGA); + if (pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL)) + pSiS->VBFlags = pSiS->VBFlags | CRT2_TV; + else + pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_TV); + break; + case CRT2_LCD: + pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_TV | CRT2_VGA); + if (pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL)) + pSiS->VBFlags = pSiS->VBFlags | CRT2_LCD; + else + pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_LCD); + break; + case CRT2_VGA: + pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_TV | CRT2_LCD); + if (pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL)) + pSiS->VBFlags = pSiS->VBFlags | CRT2_VGA; + else + pSiS->VBFlags = pSiS->VBFlags & ~(CRT2_VGA); + break; + } SISDACPreInit(pScrn); outw(VGA_SEQ_INDEX, (unlock << 8) | 0x05); /* Set the min pixel clock */ - pSiS->MinClock = 16250; /* XXX Guess, need to check this */ + pSiS->MinClock = 16250; /* XXX Guess, need to check this */ xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "Min pixel clock is %d MHz\n", - pSiS->MinClock / 1000); + pSiS->MinClock / 1000); from = X_PROBED; /* @@ -888,7 +918,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) from = X_CONFIG; } xf86DrvMsg(pScrn->scrnIndex, from, "Max pixel clock is %d MHz\n", - pSiS->MaxClock / 1000); + pSiS->MaxClock / 1000); /* * Setup the ClockRanges, which describe what clock ranges are available, @@ -915,13 +945,13 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) * XXX Assuming min height 128, max 4096 */ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, - pScrn->display->modes, clockRanges, - NULL, 256, 8192, - pScrn->bitsPerPixel * 8, 128, 4096, - pScrn->display->virtualX, - pScrn->display->virtualY, - pSiS->FbMapSize, - LOOKUP_BEST_REFRESH); + pScrn->display->modes, clockRanges, + NULL, 256, 8192, + pScrn->bitsPerPixel * 8, 128, 4096, + pScrn->display->virtualX, + pScrn->display->virtualY, + pSiS->FbMapSize, + LOOKUP_BEST_REFRESH); if (i == -1) { SISFreeRec(pScrn); @@ -964,7 +994,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) case 32: mod = "fb"; Sym = "fbScreenInit"; - break; + break; } if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { @@ -992,6 +1022,15 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) xf86LoaderReqSymLists(xaaSymbols, NULL); } + /* Load shadowfb if needed */ + if (pSiS->ShadowFB) { + if (!xf86LoadSubModule(pScrn, "shadowfb")) { + SISFreeRec(pScrn); + return FALSE; + } + xf86LoaderReqSymLists(shadowSymbols, NULL); + } + /* Load DDC if needed */ /* This gives us DDC1 - we should be able to get DDC2B using i2c */ if (!xf86LoadSubModule(pScrn, "ddc")) { @@ -1000,10 +1039,11 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } xf86LoaderReqSymLists(ddcSymbols, NULL); +#if 0 /* Initialize DDC1 if possible */ -/* if (pSiS->ddc1Read) - xf86PrintEDID(xf86DoEDID_DDC1(pScrn->scrnIndex,vgaHWddc1SetSpeed,pSiS->ddc1Read ) ); */ - + if (pSiS->ddc1Read) + xf86PrintEDID(xf86DoEDID_DDC1(pScrn->scrnIndex,vgaHWddc1SetSpeed,pSiS->ddc1Read)); +#endif return TRUE; } @@ -1044,16 +1084,16 @@ SISMapMem(ScrnInfoPtr pScrn) * setting CPUToScreenColorExpandBase. */ pSiS->IOBaseDense = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, - pSiS->PciTag, pSiS->IOAddress, 0x10000); + pSiS->PciTag, pSiS->IOAddress, 0x10000); if (pSiS->IOBaseDense == NULL) return FALSE; #endif /* __alpha__ */ pSiS->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, - pSiS->PciTag, - (unsigned long)pSiS->FbAddress, - pSiS->FbMapSize); + pSiS->PciTag, + (unsigned long)pSiS->FbAddress, + pSiS->FbMapSize); if (pSiS->FbBase == NULL) return FALSE; @@ -1123,16 +1163,16 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) SISRegPtr sisReg; vgaHWUnlock(hwp); - - SISModifyModeInfo(mode); + + SISModifyModeInfo(mode); /* Initialise the ModeReg values */ if (!vgaHWInit(pScrn, mode)) - return FALSE; - pScrn->vtSema = TRUE; + return FALSE; + pScrn->vtSema = TRUE; if (!(*pSiS->ModeInit)(pScrn, mode)) - return FALSE; + return FALSE; PDEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "HDisplay: %d, VDisplay: %d \n", @@ -1141,27 +1181,23 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) /* Program the registers */ vgaHWProtect(pScrn, TRUE); vgaReg = &hwp->ModeReg; - sisReg = &pSiS->ModeReg; + sisReg = &pSiS->ModeReg; vgaReg->Attribute[0x10] = 0x01; if (pScrn->bitsPerPixel > 8) - vgaReg->Graphics[0x05] = 0x00; + vgaReg->Graphics[0x05] = 0x00; - vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); + vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); - if( (pSiS->Chipset == PCI_CHIP_SIS300) || - (pSiS->Chipset == PCI_CHIP_SIS630) || - (pSiS->Chipset == PCI_CHIP_SIS540) ) - { + if ((pSiS->Chipset == PCI_CHIP_SIS300) || + (pSiS->Chipset == PCI_CHIP_SIS630) || + (pSiS->Chipset == PCI_CHIP_SIS540)) { SiSPreSetMode(pScrn); - SiSSetMode(pScrn, pScrn->currentMode); - } - else - { - (*pSiS->SiSRestore)(pScrn, sisReg); - } + SiSSetMode(pScrn, pScrn->currentMode); + } else + (*pSiS->SiSRestore)(pScrn, sisReg); - vgaHWProtect(pScrn, FALSE); + vgaHWProtect(pScrn, FALSE); /* Reserved for debug * @@ -1190,18 +1226,16 @@ SISRestore(ScrnInfoPtr pScrn) vgaHWProtect(pScrn, TRUE); - (*pSiS->SiSRestore)(pScrn, sisReg); - + (*pSiS->SiSRestore)(pScrn, sisReg); + vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL); vgaHWProtect(pScrn, FALSE); } -/* Mandatory */ - -/* This gets called at the start of each server generation */ - +/* Mandatory + * This gets called at the start of each server generation */ static Bool SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { @@ -1212,6 +1246,9 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) int ret; VisualPtr visual; unsigned long OnScreenSize; + int height, width, displayWidth; + unsigned char *FBStart; + /* * First get the ScrnInfoRec @@ -1220,7 +1257,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) hwp = VGAHWPTR(pScrn); - hwp->MapSize = 0x10000; /* Standard 64k VGA window */ + hwp->MapSize = 0x10000; /* Standard 64k VGA window */ pSiS = SISPTR(pScrn); @@ -1236,12 +1273,9 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Save the current state */ SISSave(pScrn); - /* Darken the screen for aesthetic reasons and set the viewport */ - SISSaveScreen(pScreen, SCREEN_SAVER_ON); - /* Initialise the first mode */ if (!SISModeInit(pScrn, pScrn->currentMode)) - return FALSE; + return FALSE; /* Clear frame buffer */ OnScreenSize = pScrn->displayWidth * pScrn->currentMode->VDisplay * (pScrn->bitsPerPixel / 8); @@ -1268,6 +1302,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) */ miClearVisualTypes(); + /* Setup the visuals we support. */ /* @@ -1286,23 +1321,41 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) return FALSE; } - { - static int GlobalHWQueueLength = 0; - - pSiS->cmdQueueLenPtr = &(GlobalHWQueueLength); - } + width = pScrn->virtualX; + height = pScrn->virtualY; + displayWidth = pScrn->displayWidth; + + if (pSiS->Rotate) { + height = pScrn->virtualX; + width = pScrn->virtualY; + } + + if (pSiS->ShadowFB) { + pSiS->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width); + pSiS->ShadowPtr = xalloc(pSiS->ShadowPitch * height); + displayWidth = pSiS->ShadowPitch / (pScrn->bitsPerPixel >> 3); + FBStart = pSiS->ShadowPtr; + } else { + pSiS->ShadowPtr = NULL; + FBStart = pSiS->FbBase; + } + + if (!miSetPixmapDepths()) + return FALSE; + + { + static int GlobalHWQueueLength = 0; + + pSiS->cmdQueueLenPtr = &(GlobalHWQueueLength); + } #ifdef XF86DRI - /* - * Setup DRI after visuals have been established, but before cfbScreenInit - * is called. cfbScreenInit will eventually call into the drivers - * InitGLXVisuals call back. - */ - pSiS->directRenderingEnabled = SISDRIScreenInit(pScreen); - /* Force the initialization of the context */ + pSiS->directRenderingEnabled = SISDRIScreenInit(pScreen); + /* Force the initialization of the context */ #if 0 - SISLostContext(pScreen); + SISLostContext(pScreen); #endif + #endif /* @@ -1312,27 +1365,29 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) switch (pScrn->bitsPerPixel) { case 1: - ret = xf1bppScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); + ret = xf1bppScreenInit(pScreen, FBStart, width, + height, pScrn->xDpi, pScrn->yDpi, + displayWidth); break; case 4: - ret = xf4bppScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); + ret = xf4bppScreenInit(pScreen, FBStart, width, + height, pScrn->xDpi, pScrn->yDpi, + displayWidth); break; case 8: case 16: case 24: case 32: - ret = fbScreenInit(pScreen, pSiS->FbBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth, pScrn->bitsPerPixel); + ret = fbScreenInit(pScreen, FBStart, width, + height, pScrn->xDpi, pScrn->yDpi, + displayWidth, pScrn->bitsPerPixel); + + fbPictureInit(pScreen, 0, 0); break; default: xf86DrvMsg(scrnIndex, X_ERROR, - "Internal error: invalid bpp (%d) in SISScrnInit\n", - pScrn->bitsPerPixel); + "Internal error: invalid bpp (%d) in SISScrnInit\n", + pScrn->bitsPerPixel); ret = FALSE; break; } @@ -1342,9 +1397,6 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) return FALSE; } - xf86SetBlackWhitePixels(pScreen); - - SISDGAInit(pScreen); if (pScrn->bitsPerPixel > 8) { /* Fixup RGB ordering */ @@ -1363,8 +1415,12 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) SIS1bppColorMap(pScrn); } + if (!pSiS->ShadowFB) /* hardware cursor needs to wrap this layer */ + SISDGAInit(pScreen); + xf86SetBlackWhitePixels(pScreen); + if (!pSiS->NoAccel) { - if ( pSiS->Chipset == PCI_CHIP_SIS300 || + if ( pSiS->Chipset == PCI_CHIP_SIS300 || pSiS->Chipset == PCI_CHIP_SIS630 || pSiS->Chipset == PCI_CHIP_SIS540) SiS300AccelInit(pScreen); @@ -1387,33 +1443,53 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!miCreateDefColormap(pScreen)) return FALSE; -/* marked by archer for adding VB palette +/* marked by archer for adding VB palette if (!vgaHWHandleColormaps(pScreen)) return FALSE; */ - if (!xf86HandleColormaps(pScreen, 256, 8, SISLoadPalette, NULL, - CMAP_RELOAD_ON_MODE_SWITCH)) - return FALSE; + if (!xf86HandleColormaps(pScreen, 256, 8, SISLoadPalette, NULL, + CMAP_RELOAD_ON_MODE_SWITCH)) + return FALSE; + + if(pSiS->ShadowFB) { + RefreshAreaFuncPtr refreshArea = SISRefreshArea; + + if(pSiS->Rotate) { + if (!pSiS->PointerMoved) { + pSiS->PointerMoved = pScrn->PointerMoved; + pScrn->PointerMoved = SISPointerMoved; + } + + switch(pScrn->bitsPerPixel) { + case 8: refreshArea = SISRefreshArea8; break; + case 16: refreshArea = SISRefreshArea16; break; + case 24: refreshArea = SISRefreshArea24; break; + case 32: refreshArea = SISRefreshArea32; break; + } + } + + ShadowFBInit(pScreen, refreshArea); + } xf86DPMSInit(pScreen, (DPMSSetProcPtr)SISDisplayPowerManagementSet, 0); #ifdef XvExtension - { - XF86VideoAdaptorPtr *ptr; - int n; - - n = xf86XVListGenericAdaptors(pScrn, &ptr); - if (n) { - xf86XVScreenInit(pScreen, ptr, n); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "use generic Xv\n" ); - } - } + { + XF86VideoAdaptorPtr *ptr; + int n; + + n = xf86XVListGenericAdaptors(pScrn, &ptr); + if (n) { + xf86XVScreenInit(pScreen, ptr, n); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "use generic Xv\n" ); + } + } #endif #ifdef XF86DRI if (pSiS->directRenderingEnabled) { - /* Now that mi, cfb, drm and others have done their thing, + /* Now that mi, drm and others have done their thing, * complete the DRI setup. */ pSiS->directRenderingEnabled = SISDRIFinishScreenInit(pScreen); @@ -1437,7 +1513,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Report any unused options (only for the first generation) */ if (serverGeneration == 1) { - xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); + xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); } /* Turn on the screen now */ @@ -1453,25 +1529,20 @@ SISSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; SISPtr pSiS = SISPTR(pScrn); - if( (pSiS->Chipset == PCI_CHIP_SIS300) || - (pSiS->Chipset == PCI_CHIP_SIS630) || - (pSiS->Chipset == PCI_CHIP_SIS540) ) - { + if ((pSiS->Chipset == PCI_CHIP_SIS300) || + (pSiS->Chipset == PCI_CHIP_SIS630) || + (pSiS->Chipset == PCI_CHIP_SIS540)) return SiSSetMode(xf86Screens[scrnIndex], mode); - } else - { - return SISModeInit(xf86Screens[scrnIndex], mode); - } + return SISModeInit(xf86Screens[scrnIndex], mode); } - /* * This function is used to initialize the Start Address - the first * displayed location in the video memory. */ /* Usually mandatory */ -void +void SISAdjustFrame(int scrnIndex, int x, int y, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; @@ -1519,15 +1590,15 @@ SISAdjustFrame(int scrnIndex, int x, int y, int flags) outb(VGA_SEQ_INDEX, 0x0D); temp = (base & 0xFF0000) >> 16; PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "3C5/0Dh set to hex %2X, base 0x%x\n", temp, base)); + "3C5/0Dh set to hex %2X, base 0x%x\n", temp, base)); outb(VGA_SEQ_DATA, temp); if (pSiS->VBFlags) { -/* UnLockCRT2VB(pSiS->RelIO); */ - UnLockCRT2(pSiS->RelIO+0x30); +/* UnLockCRT2(pSiS->RelIO); */ + UnLockCRT2(pSiS->RelIO+0x30); outSISIDXREG(pSiS->RelIO+4, 6, GETVAR8(base)); outSISIDXREG(pSiS->RelIO+4, 5, GETBITS(base, 15:8)); outSISIDXREG(pSiS->RelIO+4, 4, GETBITS(base, 23:16)); -/* LockCRT2VB(pSiS->RelIO); */ +/* LockCRT2(pSiS->RelIO); */ LockCRT2(pSiS->RelIO+0x30); } break; @@ -1536,7 +1607,7 @@ SISAdjustFrame(int scrnIndex, int x, int y, int flags) temp = inb(VGA_SEQ_DATA) & 0xF0; temp |= (base & 0x0F0000) >> 16; PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "3C5/27h set to hex %2X, base %d\n", temp, base)); + "3C5/27h set to hex %2X, base %d\n", temp, base)); outb(VGA_SEQ_DATA, temp); } @@ -1558,33 +1629,30 @@ SISEnterVT(int scrnIndex, int flags) SISPtr pSiS = SISPTR(pScrn); #ifdef XF86DRI - ScreenPtr pScreen; + ScreenPtr pScreen; #endif #ifdef XF86DRI - if (pSiS->directRenderingEnabled) { - pScreen = screenInfo.screens[scrnIndex]; - DRIUnlock(pScreen); - } + if (pSiS->directRenderingEnabled) { + pScreen = screenInfo.screens[scrnIndex]; + DRIUnlock(pScreen); + } #endif /* Should we re-save the text mode on each VT enter? */ - if( (pSiS->Chipset == PCI_CHIP_SIS300) || - (pSiS->Chipset == PCI_CHIP_SIS630) || - (pSiS->Chipset == PCI_CHIP_SIS540) ) - { - SiSPreSetMode(pScrn); + if((pSiS->Chipset == PCI_CHIP_SIS300) || + (pSiS->Chipset == PCI_CHIP_SIS630) || + (pSiS->Chipset == PCI_CHIP_SIS540)) { + SiSPreSetMode(pScrn); if (!SiSSetMode(pScrn, pScrn->currentMode)) return FALSE; - } + } else - { - if (!SISModeInit(pScrn, pScrn->currentMode)) - return FALSE; - } - + if (!SISModeInit(pScrn, pScrn->currentMode)) + return FALSE; + SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - + return TRUE; } @@ -1602,23 +1670,22 @@ SISLeaveVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; vgaHWPtr hwp = VGAHWPTR(pScrn); - + #ifdef XF86DRI - ScreenPtr pScreen; - SISPtr pSiS; + ScreenPtr pScreen; + SISPtr pSiS; #endif SISRestore(pScrn); vgaHWLock(hwp); #ifdef XF86DRI - pSiS = SISPTR(pScrn); - if (pSiS->directRenderingEnabled) { - pScreen = screenInfo.screens[scrnIndex]; - DRILock(pScreen, 0); - } + pSiS = SISPTR(pScrn); + if (pSiS->directRenderingEnabled) { + pScreen = screenInfo.screens[scrnIndex]; + DRILock(pScreen, 0); + } #endif - } @@ -1646,7 +1713,7 @@ SISCloseScreen(int scrnIndex, ScreenPtr pScreen) if (pScrn->vtSema) { if (pCursorInfo) pCursorInfo->HideCursor(pScrn); - SISRestore(pScrn); + SISRestore(pScrn); vgaHWLock(hwp); SISUnmapMem(pScrn); } @@ -1733,29 +1800,29 @@ static void SISModifyModeInfo(DisplayModePtr mode) { /* - mode->Clock = 31500; - mode->CrtcHTotal = 832; - mode->CrtcHDisplay = 640; - mode->CrtcHBlankStart = 648; - mode->CrtcHSyncStart = 664; - mode->CrtcHSyncEnd = 704; - mode->CrtcHBlankEnd = 824; - - mode->CrtcVTotal = 520; - mode->CrtcVDisplay = 480; - mode->CrtcVBlankStart = 488; - mode->CrtcVSyncStart = 489; - mode->CrtcVSyncEnd = 492; - mode->CrtcVBlankEnd = 512; + mode->Clock = 31500; + mode->CrtcHTotal = 832; + mode->CrtcHDisplay = 640; + mode->CrtcHBlankStart = 648; + mode->CrtcHSyncStart = 664; + mode->CrtcHSyncEnd = 704; + mode->CrtcHBlankEnd = 824; + + mode->CrtcVTotal = 520; + mode->CrtcVDisplay = 480; + mode->CrtcVBlankStart = 488; + mode->CrtcVSyncStart = 489; + mode->CrtcVSyncEnd = 492; + mode->CrtcVBlankEnd = 512; */ - if (mode->CrtcHBlankStart == mode->CrtcHDisplay) - mode->CrtcHBlankStart++; - if (mode->CrtcHBlankEnd == mode->CrtcHTotal) - mode->CrtcHBlankEnd--; - if (mode->CrtcVBlankStart == mode->CrtcVDisplay) - mode->CrtcVBlankStart++; - if (mode->CrtcVBlankEnd == mode->CrtcVTotal) - mode->CrtcVBlankEnd--; + if (mode->CrtcHBlankStart == mode->CrtcHDisplay) + mode->CrtcHBlankStart++; + if (mode->CrtcHBlankEnd == mode->CrtcHTotal) + mode->CrtcHBlankEnd--; + if (mode->CrtcVBlankStart == mode->CrtcVDisplay) + mode->CrtcVBlankStart++; + if (mode->CrtcVBlankEnd == mode->CrtcVTotal) + mode->CrtcVBlankEnd--; } void SiSPreSetMode(ScrnInfoPtr pScrn) @@ -1764,35 +1831,35 @@ void SiSPreSetMode(ScrnInfoPtr pScrn) unsigned char usScratchCR30, usScratchCR31; unsigned short SR26, SR27; unsigned long temp; - int vbflag; - - usScratchCR30 = usScratchCR31 = 0; - outb(SISCR, 0x31); - usScratchCR31 = inb(SISCR+1) & 0x06; - vbflag=pSiS->VBFlags; - switch (vbflag & (CRT2_TV|CRT2_LCD|CRT2_VGA)) - { case CRT2_TV: - if (vbflag & TV_HIVISION) usScratchCR30 |= 0x80; - else if (vbflag & TV_PAL) usScratchCR31 |= 0x01; - - if (vbflag & TV_AVIDEO) usScratchCR30 |= 0x04; - else if (vbflag & TV_SVIDEO) usScratchCR30 |= 0x08; - else if (vbflag & TV_SCART) usScratchCR30 |= 0x10; - usScratchCR30 |= 0x01; - usScratchCR31 |= 0x40; - break; - case CRT2_LCD: + int vbflag; + + usScratchCR30 = usScratchCR31 = 0; + outb(SISCR, 0x31); + usScratchCR31 = inb(SISCR+1) & 0x06; + vbflag=pSiS->VBFlags; + switch (vbflag & (CRT2_TV|CRT2_LCD|CRT2_VGA)) + { case CRT2_TV: + if (vbflag & TV_HIVISION) usScratchCR30 |= 0x80; + else if (vbflag & TV_PAL) usScratchCR31 |= 0x01; + + if (vbflag & TV_AVIDEO) usScratchCR30 |= 0x04; + else if (vbflag & TV_SVIDEO) usScratchCR30 |= 0x08; + else if (vbflag & TV_SCART) usScratchCR30 |= 0x10; + usScratchCR30 |= 0x01; + usScratchCR31 |= 0x40; + break; + case CRT2_LCD: usScratchCR30 |= 0x21; usScratchCR31 |= 0x40; - break; - case CRT2_VGA: + break; + case CRT2_VGA: usScratchCR30 |= 0x41; usScratchCR31 |= 0x40; - break; - default: - usScratchCR30 |= 0x00; - usScratchCR31 |= 0x60; - } + break; + default: + usScratchCR30 |= 0x00; + usScratchCR31 |= 0x60; + } SetReg1(SISCR, 0x30, usScratchCR30); SetReg1(SISCR, 0x31, usScratchCR31); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c index a136a702b..a295614c2 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c @@ -1,6 +1,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.4 2000/12/02 01:16:18 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.5 2001/04/19 12:40:33 alanh Exp $ */ #include "xf86.h" +#include "xf86PciInfo.h" #include "sis.h" @@ -13,93 +14,171 @@ typedef enum { OPTION_TURBOQUEUE, OPTION_FAST_VRAM, OPTION_SET_MEMCLOCK, - OPTION_FORCE_CRT2TYPE + OPTION_FORCE_CRT2TYPE, + OPTION_SHADOW_FB, + OPTION_ROTATE } SISOpts; static OptionInfoRec SISOptions[] = { - { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_PCI_RETRY, "PciRetry", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_RGB_BITS, "rgbbits", OPTV_INTEGER, {0}, -1 }, - { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_TURBOQUEUE, "TurboQueue", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_SET_MEMCLOCK, "SetMClk", OPTV_FREQ, {0}, -1 }, - { OPTION_FAST_VRAM, "FastVram", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_FORCE_CRT2TYPE, "ForceCRT2Type",OPTV_ANYSTR, {0}, FALSE }, - { -1, NULL, OPTV_NONE, {0}, FALSE } + { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_PCI_RETRY, "PciRetry", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_RGB_BITS, "rgbbits", OPTV_INTEGER, {0}, -1 }, + { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_TURBOQUEUE, "TurboQueue", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SET_MEMCLOCK, "SetMClk", OPTV_FREQ, {0}, -1 }, + { OPTION_FAST_VRAM, "FastVram", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_FORCE_CRT2TYPE, "ForceCRT2Type",OPTV_ANYSTR, {0}, FALSE }, + { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE } }; +void SiSOptions(ScrnInfoPtr pScrn); +OptionInfoPtr SISAvailableOptions(int chipid, int busid); + void SiSOptions(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); - MessageType from; - double temp; - char *strptr; - - /* Collect all of the relevant option flags (fill in pScrn->options) */ - xf86CollectOptions(pScrn, NULL); - - /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, SISOptions); - - from = X_DEFAULT; - if (pScrn->depth <= 8) { -#if 0 - if (xf86GetOptValInteger(SISOptions, OPTION_RGB_BITS, - &pScrn->rgbBits)) - { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Bits per RGB set to %d\n", pScrn->rgbBits); - } + SISPtr pSiS = SISPTR(pScrn); + MessageType from; + double temp; + char *strptr; + + /* Collect all of the relevant option flags (fill in pScrn->options) */ + xf86CollectOptions(pScrn, NULL); + + /* Process the options */ + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, SISOptions); + + /* initalize some defaults */ + pSiS->FastVram = TRUE; + pSiS->UsePCIRetry = TRUE; + pSiS->TurboQueue = TRUE; + pSiS->HWCursor = TRUE; + pSiS->Rotate = FALSE; + pSiS->ShadowFB = FALSE; + switch(pSiS->Chipset) { + case PCI_CHIP_SIS530: + pSiS->TurboQueue = FALSE; /* FIXME ? */ + break; + default: + break; + } + +#if 0 /* we only work with a depth greater or equal to 8 */ + if (pScrn->depth <= 8) { + if (xf86GetOptValInteger(SISOptions, OPTION_RGB_BITS, + &pScrn->rgbBits)) + { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Bits per RGB set to %d\n", pScrn->rgbBits); + } + } #endif - } - pSiS->HWCursor = TRUE; - if (xf86GetOptValBool(SISOptions, OPTION_HW_CURSOR, &pSiS->HWCursor)) - from = X_CONFIG; - if (xf86ReturnOptValBool(SISOptions, OPTION_SW_CURSOR, FALSE)) { - from = X_CONFIG; - pSiS->HWCursor = FALSE; - } - xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", - pSiS->HWCursor ? "HW" : "SW"); - if (xf86ReturnOptValBool(SISOptions, OPTION_NOACCEL, FALSE)) { + + /* sw/hw cursor */ + from = X_DEFAULT; + if (xf86GetOptValBool(SISOptions, OPTION_HW_CURSOR, &pSiS->HWCursor)) { + from = X_CONFIG; + } + if (xf86ReturnOptValBool(SISOptions, OPTION_SW_CURSOR, FALSE)) { + from = X_CONFIG; + pSiS->HWCursor = FALSE; + } + xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", + pSiS->HWCursor ? "HW" : "SW"); + + /* Accel */ + if (xf86ReturnOptValBool(SISOptions, OPTION_NOACCEL, FALSE)) { + pSiS->NoAccel = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); + } + + /* PCI retry */ + from = X_DEFAULT; + if (xf86GetOptValBool(SISOptions, OPTION_PCI_RETRY, &pSiS->UsePCIRetry)) { + from = X_CONFIG; + } + xf86DrvMsg(pScrn->scrnIndex, from, "PCI retry %s\n", + pSiS->UsePCIRetry ? "enabled" : "disabled"); + + /* Mem clock */ + if (xf86GetOptValFreq(SISOptions, OPTION_SET_MEMCLOCK, OPTUNITS_MHZ, + &temp)) { + pSiS->MemClock = (int)(temp * 1000.0); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Memory clock set to %.3f MHz\n", pSiS->MemClock/1000.0); + } + + /* fast VRAM */ + from = X_DEFAULT; + if (xf86GetOptValBool(SISOptions, OPTION_FAST_VRAM, &pSiS->FastVram)) { + from = X_CONFIG; + } + xf86DrvMsg(pScrn->scrnIndex, from, "Fast VRAM %s\n", + pSiS->FastVram ? "enabled" : "disabled"); + + /* Turbo QUEUE */ + from = X_DEFAULT; + if (xf86GetOptValBool(SISOptions, OPTION_TURBOQUEUE, &pSiS->TurboQueue)) { + from = X_CONFIG; + } + xf86DrvMsg(pScrn->scrnIndex, from, "TurboQueue %s\n", + pSiS->TurboQueue ? "enabled" : "disabled"); + + /* CRT2 type */ + pSiS->ForceCRT2Type = CRT2_DEFAULT; + strptr = (char *)xf86GetOptValString(SISOptions, OPTION_FORCE_CRT2TYPE); + if (strptr != NULL) + { + if (!xf86strcmp(strptr,"TV")) + pSiS->ForceCRT2Type = CRT2_TV; + if (!xf86strcmp(strptr,"LCD")) + pSiS->ForceCRT2Type = CRT2_LCD; + if (!xf86strcmp(strptr,"VGA")) + pSiS->ForceCRT2Type = CRT2_VGA; + + if (pSiS->ForceCRT2Type != CRT2_DEFAULT) + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "CRT2 Type set to: %s\n", strptr); + } + + /* ShadowFB */ + from = X_DEFAULT; + if (xf86GetOptValBool(SISOptions, OPTION_SHADOW_FB, &pSiS->ShadowFB)) { + from = X_CONFIG; + } + if (pSiS->ShadowFB) { pSiS->NoAccel = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); - } - if (xf86ReturnOptValBool(SISOptions, OPTION_PCI_RETRY, FALSE)) { - pSiS->UsePCIRetry = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI retry enabled\n"); - } - if (xf86GetOptValFreq(SISOptions, OPTION_SET_MEMCLOCK, OPTUNITS_MHZ, - &temp)) { - pSiS->MemClock = (int)(temp * 1000.0); - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Memory clock set to %.3f MHz\n", - pSiS->MemClock/1000.0); - } - if (xf86ReturnOptValBool(SISOptions, OPTION_FAST_VRAM, FALSE)) { - pSiS->FastVram = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Fast VRAM enabled\n"); + xf86DrvMsg(pScrn->scrnIndex, from, + "Using \"Shadow Frame Buffer\" - acceleration disabled\n"); } -/* if (xf86ReturnOptValBool(SISOptions, OPTION_TURBOQUEUE, FALSE)) { - pSiS->TurboQueue = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Enabling TurboQueue\n"); - } */ - pSiS->TurboQueue = TRUE; - - - pSiS->ForceCRT2Type= CRT2_DEFAULT; - strptr = (char *)xf86GetOptValString(SISOptions,OPTION_FORCE_CRT2TYPE); - if (strptr != 0) - { - if (!xf86strcmp(strptr,"TV")) - pSiS->ForceCRT2Type = CRT2_TV; - if (!xf86strcmp(strptr,"LCD")) - pSiS->ForceCRT2Type = CRT2_LCD; - if (!xf86strcmp(strptr,"VGA")) - pSiS->ForceCRT2Type = CRT2_VGA; - } + /* Rotate */ + if ((strptr = (char *)xf86GetOptValString(SISOptions, OPTION_ROTATE))) { + if(!xf86NameCmp(strptr, "CW")) { + pSiS->ShadowFB = TRUE; + pSiS->NoAccel = TRUE; + pSiS->HWCursor = FALSE; + pSiS->Rotate = 1; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Rotating screen clockwise - acceleration disabled\n"); + } else + if (!xf86NameCmp(strptr, "CCW")) { + pSiS->ShadowFB = TRUE; + pSiS->NoAccel = TRUE; + pSiS->HWCursor = FALSE; + pSiS->Rotate = -1; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Rotating screen counter clockwise - acceleration disabled\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "\"%s\" is not a valid value for Option \"Rotate\"\n", strptr); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Valid options are \"CW\" or \"CCW\"\n"); + } + } } OptionInfoPtr @@ -107,4 +186,3 @@ SISAvailableOptions(int chipid, int busid) { return SISOptions; } - diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h index 432eaf99c..cbf4f5d6d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h @@ -25,85 +25,82 @@ * Mitani Hiroshi <hmitani@drl.mei.co.jp> * David Thomas <davtom@dream.org.uk>. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h,v 1.14 2000/12/02 01:16:18 dawes Exp $ */ - -#include "vgaHW.h" - -#define inSISREG(base) inb(base) -#define outSISREG(base,val) outb(base,val) -#define orSISREG(base,val) do { \ - unsigned char temp = inb(base); \ - outSISREG(base, temp | (val)); \ - } while (0) -#define andSISREG(base,val) do { \ - unsigned char temp = inb(base); \ - outSISREG(base, temp & (val)); \ - } while (0) - -#define inSISIDXREG(base,idx,var) do { \ - outb(base,idx); var=inb((base)+1); \ - } while (0) +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h,v 1.15 2001/04/19 12:40:33 alanh Exp $ */ + +#define inSISREG(base) inb(base) +#define outSISREG(base,val) outb(base,val) +#define orSISREG(base,val) do { \ + unsigned char __Temp = inb(base); \ + outSISREG(base, __Temp | (val)); \ + } while (0) +#define andSISREG(base,val) do { \ + unsigned char __Temp = inb(base); \ + outSISREG(base, __Temp & (val)); \ + } while (0) + +#define inSISIDXREG(base,idx,var) do { \ + outb(base,idx); var=inb((base)+1); \ + } while (0) #if 0 -#define outSISIDXREG(base,idx,val) outw(base, (val)<<8 | (idx)); +#define outSISIDXREG(base,idx,val) outw(base, (val)<<8 | (idx)); #endif -#define outSISIDXREG(base,idx,val) do { \ - outb(base,idx); outb((base)+1,val); \ - } while (0) -#define orSISIDXREG(base,idx,val) do { \ - unsigned char temp; \ - outb(base,idx); \ - temp = inb((base)+1)|(val); \ - outSISIDXREG(base,idx,temp); \ - } while (0) -#define andSISIDXREG(base,idx,and) do { \ - unsigned char temp; \ - outb(base,idx); \ - temp = inb((base)+1)&(and); \ - outSISIDXREG(base,idx,temp); \ - } while (0) -#define setSISIDXREG(base,idx,and,or) do { \ - unsigned char temp; \ - outb(base,idx); \ - temp = (inb((base)+1)&(and))|(or); \ - outSISIDXREG(base,idx,temp); \ - } while (0) - -#define BITMASK(h,l) (((unsigned)(1U << ((h)-(l)+1))-1)<<(l)) -#define GENMASK(mask) BITMASK(1?mask,0?mask) - -#define GETBITS(var,mask) (((var) & GENMASK(mask)) >> (0?mask)) -#define SETBITS(val,mask) ((val) << (0?mask)) -#define SETBIT(n) (1<<(n)) - -#define GETBITSTR(val,from,to) ((GETBITS(val,from)) << (0?to)) -#define SETVARBITS(var,val,from,to) (((var)&(~(GENMASK(to)))) | \ - GETBITSTR(val,from,to)) -#define GETVAR8(var) ((var)&0xFF) -#define SETVAR8(var,val) (var) = GETVAR8(val) - -#define VGA_RELIO_BASE 0x380 - -#define AROFFSET VGA_ATTR_INDEX - VGA_RELIO_BASE -#define ARROFFSET VGA_ATTR_DATA_R - VGA_RELIO_BASE -#define GROFFSET VGA_GRAPH_INDEX - VGA_RELIO_BASE -#define SROFFSET VGA_SEQ_INDEX - VGA_RELIO_BASE -#define CROFFSET VGA_CRTC_INDEX_OFFSET + VGA_IOBASE_COLOR-VGA_RELIO_BASE -#define MISCROFFSET VGA_MISC_OUT_R - VGA_RELIO_BASE -#define MISCWOFFSET VGA_MISC_OUT_W - VGA_RELIO_BASE - -#define SISAR pSiS->RElIO+AROFFSET -#define SISARR pSiS->RELIO+ARROFFSET -#define SISGR pSiS->RELIO+GROFFSET -#define SISSR pSiS->RelIO+SROFFSET -#define SISCR pSiS->RelIO+CROFFSET -#define SISMISCR pSiS->RelIO+MISCROFFSET -#define SISMISCW pSiS->RelIO+MISCWOFFSET +#define outSISIDXREG(base,idx,val) do { \ + outb(base,idx); outb((base)+1,val); \ + } while (0) +#define orSISIDXREG(base,idx,val) do { \ + unsigned char __Temp; \ + outb(base,idx); \ + __Temp = inb((base)+1)|(val); \ + outSISIDXREG(base,idx,__Temp); \ + } while (0) +#define andSISIDXREG(base,idx,and) do { \ + unsigned char __Temp; \ + outb(base,idx); \ + __Temp = inb((base)+1)&(and); \ + outSISIDXREG(base,idx,__Temp); \ + } while (0) +#define setSISIDXREG(base,idx,and,or) do { \ + unsigned char __Temp; \ + outb(base,idx); \ + __Temp = (inb((base)+1)&(and))|(or); \ + outSISIDXREG(base,idx,__Temp); \ + } while (0) + +#define BITMASK(h,l) (((unsigned)(1U << ((h)-(l)+1))-1)<<(l)) +#define GENMASK(mask) BITMASK(1?mask,0?mask) + +#define GETBITS(var,mask) (((var) & GENMASK(mask)) >> (0?mask)) +#define SETBITS(val,mask) ((val) << (0?mask)) +#define SETBIT(n) (1<<(n)) + +#define GETBITSTR(val,from,to) ((GETBITS(val,from)) << (0?to)) +#define SETVARBITS(var,val,from,to) (((var)&(~(GENMASK(to)))) | \ + GETBITSTR(val,from,to)) +#define GETVAR8(var) ((var)&0xFF) +#define SETVAR8(var,val) (var) = GETVAR8(val) + +#define VGA_RELIO_BASE 0x380 + +#define AROFFSET VGA_ATTR_INDEX - VGA_RELIO_BASE +#define ARROFFSET VGA_ATTR_DATA_R - VGA_RELIO_BASE +#define GROFFSET VGA_GRAPH_INDEX - VGA_RELIO_BASE +#define SROFFSET VGA_SEQ_INDEX - VGA_RELIO_BASE +#define CROFFSET VGA_CRTC_INDEX_OFFSET + VGA_IOBASE_COLOR-VGA_RELIO_BASE +#define MISCROFFSET VGA_MISC_OUT_R - VGA_RELIO_BASE +#define MISCWOFFSET VGA_MISC_OUT_W - VGA_RELIO_BASE + +#define SISAR pSiS->RElIO+AROFFSET +#define SISARR pSiS->RELIO+ARROFFSET +#define SISGR pSiS->RELIO+GROFFSET +#define SISSR pSiS->RelIO+SROFFSET +#define SISCR pSiS->RelIO+CROFFSET +#define SISMISCR pSiS->RelIO+MISCROFFSET +#define SISMISCW pSiS->RelIO+MISCWOFFSET #define SISPART1 pSiS->RelIO+0x04 #define SISPART2 pSiS->RelIO+0x10 #define SISPART3 pSiS->RelIO+0x12 -#define SISPART4 pSiS->RelIO+0x14 -#define SISPART5 pSiS->RelIO+0x16 - +#define SISPART4 pSiS->RelIO+0x14 +#define SISPART5 pSiS->RelIO+0x16 /* 3C4 */ #define BankReg 0x06 @@ -144,44 +141,43 @@ extern int sisReg32MMIO[]; * Modified for Sis by Xavier Ducoin (xavier@rd.lectra.fr) */ +#define sisLEFT2RIGHT 0x10 +#define sisRIGHT2LEFT 0x00 +#define sisTOP2BOTTOM 0x20 +#define sisBOTTOM2TOP 0x00 -#define sisLEFT2RIGHT 0x10 -#define sisRIGHT2LEFT 0x00 -#define sisTOP2BOTTOM 0x20 -#define sisBOTTOM2TOP 0x00 - -#define sisSRCSYSTEM 0x03 -#define sisSRCVIDEO 0x02 -#define sisSRCFG 0x01 -#define sisSRCBG 0x00 +#define sisSRCSYSTEM 0x03 +#define sisSRCVIDEO 0x02 +#define sisSRCFG 0x01 +#define sisSRCBG 0x00 -#define sisCMDBLT 0x0000 -#define sisCMDBLTMSK 0x0100 -#define sisCMDCOLEXP 0x0200 -#define sisCMDLINE 0x0300 +#define sisCMDBLT 0x0000 +#define sisCMDBLTMSK 0x0100 +#define sisCMDCOLEXP 0x0200 +#define sisCMDLINE 0x0300 -#define sisCMDENHCOLEXP 0x2000 +#define sisCMDENHCOLEXP 0x2000 -#define sisXINCREASE 0x10 -#define sisYINCREASE 0x20 -#define sisCLIPENABL 0x40 -#define sisCLIPINTRN 0x80 -#define sisCLIPEXTRN 0x00 +#define sisXINCREASE 0x10 +#define sisYINCREASE 0x20 +#define sisCLIPENABL 0x40 +#define sisCLIPINTRN 0x80 +#define sisCLIPEXTRN 0x00 -#define sisPATREG 0x08 -#define sisPATFG 0x04 -#define sisPATBG 0x00 +#define sisPATREG 0x08 +#define sisPATFG 0x04 +#define sisPATBG 0x00 -#define sisLASTPIX 0x0800 -#define sisXMAJOR 0x0400 +#define sisLASTPIX 0x0800 +#define sisXMAJOR 0x0400 /* Macros to do useful things with the SIS BitBLT engine */ #define sisBLTSync \ while(*(volatile unsigned short *)(pSiS->IOBase + BR(10)+2) & \ - (0x4000)){} + (0x4000)){} /* According to SiS 6326 2D programming guide, 16 bits position at */ /* 0x82A8 returns queue free. But this don't work, so don't wait */ @@ -191,9 +187,9 @@ extern int sisReg32MMIO[]; #define sisBLTWAIT \ if (!pSiS->TurboQueue) {\ while(*(volatile unsigned short *)(pSiS->IOBase + BR(10)+2) & \ - (0x4000)){}} /* \ + (0x4000)){}} /* \ else {while(*(volatile unsigned short *)(pSiS->IOBase + BR(10)) < \ - 63){}} */ + 63){}} */ #define sisSETPATREG()\ ((unsigned char *)(pSiS->IOBase + BR(11))) @@ -283,3 +279,154 @@ extern int sisReg32MMIO[]; *(volatile unsigned short *)(pSiS->IOBase + BR(7)) = ErrorTerm +/* SiS Registers for Xv */ + +/* VGA standard register */ +#define Index_SR_Graphic_Mode 0x06 +#define Index_SR_RAMDAC_Ctrl 0x07 +#define Index_SR_Threshold_Ctrl1 0x08 +#define Index_SR_Threshold_Ctrl2 0x09 +#define Index_SR_Misc_Ctrl 0x0F +#define Index_SR_DDC 0x11 +#define Index_SR_Feature_Connector_Ctrl 0x12 +#define Index_SR_DRAM_Sizing 0x14 +#define Index_SR_DRAM_State_Machine_Ctrl 0x15 +#define Index_SR_AGP_PCI_State_Machine 0x21 +#define Index_SR_Internal_MCLK0 0x28 +#define Index_SR_Internal_MCLK1 0x29 +#define Index_SR_Internal_DCLK1 0x2B +#define Index_SR_Internal_DCLK2 0x2C +#define Index_SR_Internal_DCLK3 0x2D +#define Index_SR_Ext_Clock_Sel 0x32 +#define Index_SR_Int_Status 0x34 +#define Index_SR_Int_Enable 0x35 +#define Index_SR_Int_Reset 0x36 +#define Index_SR_Power_On_Trap 0x38 +#define Index_SR_Power_On_Trap2 0x39 +#define Index_SR_Power_On_Trap3 0x3A + +/* video registers */ +#define Index_VI_Passwd 0x00 +#define Index_VI_Win_Hor_Disp_Start_Low 0x01 +#define Index_VI_Win_Hor_Disp_End_Low 0x02 +#define Index_VI_Win_Hor_Over 0x03 + +#define Index_VI_Win_Ver_Disp_Start_Low 0x04 +#define Index_VI_Win_Ver_Disp_End_Low 0x05 +#define Index_VI_Win_Ver_Over 0x06 + +#define Index_VI_Disp_Y_Buf_Start_Low 0x07 +#define Index_VI_Disp_Y_Buf_Start_Middle 0x08 +#define Index_VI_Disp_Y_Buf_Start_High 0x09 + +#define Index_VI_U_Buf_Start_Low 0x0A +#define Index_VI_U_Buf_Start_Middle 0x0B +#define Index_VI_U_Buf_Start_High 0x0C + +#define Index_VI_V_Buf_Start_Low 0x0D +#define Index_VI_V_Buf_Start_Middle 0x0E +#define Index_VI_V_Buf_Start_High 0x0F + +#define Index_VI_Disp_Y_Buf_Pitch_Low 0x10 +#define Index_VI_Disp_UV_Buf_Pitch_Low 0x11 +#define Index_VI_Disp_Y_UV_Buf_Pitch_High 0x12 + +#define Index_VI_Disp_Y_Buf_Preset_Low 0x13 +#define Index_VI_Disp_Y_Buf_Preset_Middle 0x14 +#define Index_VI_UV_Buf_Preset_Low 0x15 +#define Index_VI_UV_Buf_Preset_Middle 0x16 +#define Index_VI_Disp_Y_UV_Buf_Preset_High 0x17 + +#define Index_VI_Hor_Post_Up_Scale_Low 0x18 +#define Index_VI_Hor_Post_Up_Scale_High 0x19 +#define Index_VI_Ver_Up_Scale_Low 0x1A +#define Index_VI_Ver_Up_Scale_High 0x1B +#define Index_VI_Scale_Control 0x1C + +#define Index_VI_Play_Threshold_Low 0x1D +#define Index_VI_Play_Threshold_High 0x1E +#define Index_VI_Line_Buffer_Size 0x1F + +/* Destination color key */ +#define Index_VI_Overlay_ColorKey_Red_Min 0x20 +#define Index_VI_Overlay_ColorKey_Green_Min 0x21 +#define Index_VI_Overlay_ColorKey_Blue_Min 0x22 +#define Index_VI_Overlay_ColorKey_Red_Max 0x23 +#define Index_VI_Overlay_ColorKey_Green_Max 0x24 +#define Index_VI_Overlay_ColorKey_Blue_Max 0x25 + +/* Source color key */ +#define Index_VI_Overlay_ChromaKey_Red_Y_Min 0x26 +#define Index_VI_Overlay_ChromaKey_Green_U_Min 0x27 +#define Index_VI_Overlay_ChromaKey_Blue_V_Min 0x28 +#define Index_VI_Overlay_ChromaKey_Red_Y_Max 0x29 +#define Index_VI_Overlay_ChromaKey_Green_U_Max 0x2A +#define Index_VI_Overlay_ChromaKey_Blue_V_Max 0x2B + +#define Index_VI_Contrast_Factor 0x2C + +#define Index_VI_Brightness 0x2D +#define Index_VI_Contrast_Enh_Ctrl 0x2E + +#define Index_VI_Key_Overlay_OP 0x2F + +#define Index_VI_Control_Misc0 0x30 +#define Index_VI_Control_Misc1 0x31 +#define Index_VI_Control_Misc2 0x32 + +#define Index_MPEG_Read_Ctrl0 0x60 +#define Index_MPEG_Read_Ctrl1 0x61 +#define Index_MPEG_Read_Ctrl2 0x62 +#define Index_MPEG_Read_Ctrl3 0x63 +#define Index_MPEG_Ver_Up_Scale_Low 0x64 +#define Index_MPEG_Ver_Up_Scale_High 0x65 + +/* + CRT_2 function control register + */ +#define Index_CRT2_FC_CONTROL 0x00 +#define Index_CRT2_FC_SCREEN_HIGH 0x04 +#define Index_CRT2_FC_SCREEN_MID 0x05 +#define Index_CRT2_FC_SCREEN_LOW 0x06 +#define Index_CRT2_FC_ENABLE_WRITE 0x24 +#define Index_CRT2_FC_VR 0x25 +#define Index_CRT2_FC_VCount 0x27 +#define Index_CRT2_FC_VCount1 0x28 + +/* video attributes - these should probably be configurable on the fly + * so users with different desktop sizes can keep + * captured data off the desktop + */ +#define _VINWID 704 +#define _VINHGT _VINHGT_NTSC +#define _VINHGT_NTSC 240 +#define _VINHGT_PAL 290 +#define _VIN_WINDOW (704 * 291 * 2) +#define _VBI_WINDOW (704 * 64 * 2) + +#define _VIN_FIELD_EVEN 1 +#define _VIN_FIELD_ODD 2 +#define _VIN_FIELD_BOTH 4 + +#define vc_index_offset 0x00 +#define vc_data_offset 0x01 +#define vi_index_offset 0x02 +#define vi_data_offset 0x03 +#define crt2_index_offset 0x04 +#define crt2_port_offset 0x05 +#define sr_index_offset 0x44 +#define sr_data_offset 0x45 +#define cr_index_offset 0x54 +#define cr_data_offset 0x55 +#define input_stat 0x5A + +/* i2c registers */ +#define X_INDEXREG 0x14 +#define X_PORTREG 0x15 +#define X_DATA 0x0f +#define I2C_SCL 0x00 +#define I2C_SDA 0x01 +#define I2C_DELAY 10 + +/* mmio registers */ +#define REG_PRIM_CRT_COUNTER 0x8514 diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c index 349e55c87..85189ecd7 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c @@ -25,14 +25,12 @@ * Mitani Hiroshi <hmitani@drl.mei.co.jp> * David Thomas <davtom@dream.org.uk>. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c,v 1.4 2001/01/21 21:19:32 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c,v 1.5 2001/04/19 12:40:33 alanh Exp $ */ #include "fb.h" #include "xf1bpp.h" #include "xf4bpp.h" -#include "mibank.h" -#include "micmap.h" #include "xf86.h" #include "xf86_OSproc.h" #include "xf86Resources.h" @@ -41,15 +39,10 @@ #include "xf86PciInfo.h" #include "xf86Pci.h" #include "xf86cmap.h" -#include "vgaHW.h" -#include "xf86RAC.h" -#include "mipointer.h" - -#include "mibstore.h" - -#include "sis_regs.h" #include "sis.h" +#include "sis_regs.h" +#include "sis_dac.h" #define _XF86DGA_SERVER_ #include "extensions/xf86dgastr.h" @@ -58,112 +51,112 @@ #define DPMS_SERVER #include "extensions/dpms.h" -static char *dramTypeStr[] = { - "Fast Page DRAM", - "2 cycle EDO RAM", - "1 cycle EDO RAM", - "SDRAM/SGRAM", - "SDRAM", - "SGRAM", - "ESDRAM" - "" }; +static char *dramTypeStr[] = { + "Fast Page DRAM", + "2 cycle EDO RAM", + "1 cycle EDO RAM", + "SDRAM/SGRAM", + "SDRAM", + "SGRAM", + "ESDRAM" + "" }; + +static int clockTable[4] = { 66, 75, 83, 100 }; -static int clockTable[4] = { 66, 75, 83, 100 }; +void SiSSetup(ScrnInfoPtr pScrn); -static void +static void sisOldChipSetup(ScrnInfoPtr pScrn) { - int ramsize[4] = {1024, 2048, 4096, 1024}; + int ramsize[4] = {1024, 2048, 4096, 1024}; - SISPTR(pScrn)->TurboQueue = FALSE; + SISPTR(pScrn)->TurboQueue = FALSE; - outb(VGA_SEQ_INDEX, RAMSize); - pScrn->videoRam = ramsize[inb(VGA_SEQ_DATA) & 3]; + outb(VGA_SEQ_INDEX, RAMSize); + pScrn->videoRam = ramsize[inb(VGA_SEQ_DATA) & 3]; } -static void +static void sis530Setup(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); - int ramsize[8] = { 1, 2, 4, 0, 0, 2, 4, 8}; - int buswidth[8] = { 0, 64, 64, 0, 0, 32, 32, 64 }; - int config; - int temp; - - if (pSiS->Chipset == PCI_CHIP_SIS5597) { - outb(VGA_SEQ_INDEX, FBSize); - pScrn->videoRam = ((inb(VGA_SEQ_DATA) & 7) + 1)*256; - outb(VGA_SEQ_INDEX, Mode64); - if (inb(VGA_SEQ_DATA) & 6) - pScrn->videoRam *= 2; - } - else { - outb(VGA_SEQ_INDEX, RAMSize); - temp = inb(VGA_SEQ_DATA); - config = ((temp & 0x10) >> 2 ) | ((temp & 6) >> 1); - pScrn->videoRam = ramsize[config] * 1024; - pSiS->BusWidth = buswidth[config]; - } - - if (pSiS->Chipset == PCI_CHIP_SIS530) { - outb(VGA_SEQ_INDEX, 0x10); - pSiS->MemClock = clockTable[inb(VGA_SEQ_DATA) & 0x03] * 1000; - outb(VGA_SEQ_INDEX, 0x0d); - if (inb(VGA_SEQ_DATA) & 0x01) - pSiS->Flags |= UMA; - } else - pSiS->MemClock = SiSMclk(pSiS); - - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected memory clock : %3.3fMHz\n", - pSiS->MemClock/1000.0); + SISPtr pSiS = SISPTR(pScrn); + int ramsize[8] = { 1, 2, 4, 0, 0, 2, 4, 8}; + int buswidth[8] = { 0, 64, 64, 0, 0, 32, 32, 64 }; + int config; + int temp; + + if (pSiS->Chipset == PCI_CHIP_SIS5597) { + outb(VGA_SEQ_INDEX, FBSize); + pScrn->videoRam = ((inb(VGA_SEQ_DATA) & 7) + 1)*256; + outb(VGA_SEQ_INDEX, Mode64); + if (inb(VGA_SEQ_DATA) & 6) + pScrn->videoRam *= 2; + } else { + outb(VGA_SEQ_INDEX, RAMSize); + temp = inb(VGA_SEQ_DATA); + config = ((temp & 0x10) >> 2 ) | ((temp & 0x6) >> 1); + pScrn->videoRam = ramsize[config] * 1024; + pSiS->BusWidth = buswidth[config]; + } + + if (pSiS->Chipset == PCI_CHIP_SIS530) { + outb(VGA_SEQ_INDEX, 0x10); + pSiS->MemClock = clockTable[inb(VGA_SEQ_DATA) & 0x03] * 1000; + outb(VGA_SEQ_INDEX, 0x0d); + if (inb(VGA_SEQ_DATA) & 0x01) + pSiS->Flags |= UMA; + } else + pSiS->MemClock = SiSMclk(pSiS); + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected memory clock : %3.3fMHz\n", pSiS->MemClock/1000.0); } -static void +static void sis300Setup(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); - int bus[4] = {32, 64, 128, 32}; - unsigned int config; - - pSiS->MemClock = SiSMclk(pSiS); - - outb(VGA_SEQ_INDEX, 0x14); - config = inb(VGA_SEQ_DATA); - pScrn->videoRam = ((config & 0x3F) + 1) * 1024; - pSiS->BusWidth =bus[config >> 6]; - - outb(VGA_SEQ_INDEX, 0x3A); - config = inb(VGA_SEQ_DATA) & 3; - - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected DRAM type : %s\n", dramTypeStr[config+4]); - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected memory clock : %3.3fMHz\n", - pSiS->MemClock/1000.0); - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + SISPtr pSiS = SISPTR(pScrn); + int bus[4] = {32, 64, 128, 32}; + unsigned int config; + + pSiS->MemClock = SiSMclk(pSiS); + + outb(VGA_SEQ_INDEX, 0x14); + config = inb(VGA_SEQ_DATA); + pScrn->videoRam = ((config & 0x3F) + 1) * 1024; + pSiS->BusWidth =bus[config >> 6]; + + outb(VGA_SEQ_INDEX, 0x3A); + config = inb(VGA_SEQ_DATA) & 3; + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected DRAM type : %s\n", dramTypeStr[config+4]); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected memory clock : %3.3fMHz\n", + pSiS->MemClock/1000.0); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected VRAM bus width is %d\n", pSiS->BusWidth); } void SiSSetup(ScrnInfoPtr pScrn) { - SISPTR(pScrn)->Flags = 0; - - SISPTR(pScrn)->VBFlags = 0; - switch (SISPTR(pScrn)->Chipset) { - case PCI_CHIP_SIS5597: - case PCI_CHIP_SIS6326: - case PCI_CHIP_SIS530: - sis530Setup(pScrn); - break; - case PCI_CHIP_SIS300: - case PCI_CHIP_SIS630: - case PCI_CHIP_SIS540: - sis300Setup(pScrn); - break; - default: - sisOldChipSetup(pScrn); - break; - } + SISPTR(pScrn)->Flags = 0; + + SISPTR(pScrn)->VBFlags = 0; + switch (SISPTR(pScrn)->Chipset) { + case PCI_CHIP_SIS5597: + case PCI_CHIP_SIS6326: + case PCI_CHIP_SIS530: + sis530Setup(pScrn); + break; + case PCI_CHIP_SIS300: + case PCI_CHIP_SIS630: + case PCI_CHIP_SIS540: + sis300Setup(pScrn); + break; + default: + sisOldChipSetup(pScrn); + break; + } } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c new file mode 100644 index 000000000..de5bda5ae --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c @@ -0,0 +1,247 @@ +/* + * Copyright (c) 1999, The XFree86 Project Inc. + * based on code written by Mark Vojkovich <markv@valinux.com> + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c,v 1.2 2001/04/19 14:11:37 alanh Exp $ */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86_ansic.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "sis.h" +#include "servermd.h" + +#include "sis_shadow.h" + +void +SISRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + SISPtr pSiS = SISPTR(pScrn); + int width, height, Bpp, FBPitch; + unsigned char *src, *dst; + + Bpp = pScrn->bitsPerPixel >> 3; + FBPitch = BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel); + + while(num--) { + width = (pbox->x2 - pbox->x1) * Bpp; + height = pbox->y2 - pbox->y1; + src = pSiS->ShadowPtr + (pbox->y1 * pSiS->ShadowPitch) + + (pbox->x1 * Bpp); + dst = pSiS->FbBase + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp); + + while(height--) { + memcpy(dst, src, width); + dst += FBPitch; + src += pSiS->ShadowPitch; + } + + pbox++; + } +} + +void +SISPointerMoved(int index, int x, int y) +{ + ScrnInfoPtr pScrn = xf86Screens[index]; + SISPtr pSiS = SISPTR(pScrn); + int newX, newY; + + if(pSiS->Rotate == 1) { + newX = pScrn->pScreen->height - y - 1; + newY = x; + } else { + newX = y; + newY = pScrn->pScreen->width - x - 1; + } + + (*pSiS->PointerMoved)(index, newX, newY); +} + +void +SISRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + SISPtr pSiS = SISPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch; + CARD8 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -pSiS->Rotate * pSiS->ShadowPitch; + + while(num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~3; + y2 = (pbox->y2 + 3) & ~3; + height = (y2 - y1) >> 2; /* in dwords */ + + if(pSiS->Rotate == 1) { + dstPtr = pSiS->FbBase + + (pbox->x1 * dstPitch) + pScrn->virtualX - y2; + srcPtr = pSiS->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1; + } else { + dstPtr = pSiS->FbBase + + ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; + srcPtr = pSiS->ShadowPtr + (y1 * srcPitch) + pbox->x2 - 1; + } + + while(width--) { + src = srcPtr; + dst = (CARD32*)dstPtr; + count = height; + while(count--) { + *(dst++) = src[0] | (src[srcPitch] << 8) | + (src[srcPitch * 2] << 16) | + (src[srcPitch * 3] << 24); + src += srcPitch * 4; + } + srcPtr += pSiS->Rotate; + dstPtr += dstPitch; + } + + pbox++; + } +} + + +void +SISRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + SISPtr pSiS = SISPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch; + CARD16 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -pSiS->Rotate * pSiS->ShadowPitch >> 1; + + while(num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~1; + y2 = (pbox->y2 + 1) & ~1; + height = (y2 - y1) >> 1; /* in dwords */ + + if(pSiS->Rotate == 1) { + dstPtr = (CARD16*)pSiS->FbBase + + (pbox->x1 * dstPitch) + pScrn->virtualX - y2; + srcPtr = (CARD16*)pSiS->ShadowPtr + + ((1 - y2) * srcPitch) + pbox->x1; + } else { + dstPtr = (CARD16*)pSiS->FbBase + + ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; + srcPtr = (CARD16*)pSiS->ShadowPtr + + (y1 * srcPitch) + pbox->x2 - 1; + } + + while(width--) { + src = srcPtr; + dst = (CARD32*)dstPtr; + count = height; + while(count--) { + *(dst++) = src[0] | (src[srcPitch] << 16); + src += srcPitch * 2; + } + srcPtr += pSiS->Rotate; + dstPtr += dstPitch; + } + + pbox++; + } +} + + +/* this one could be faster */ +void +SISRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + SISPtr pSiS = SISPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch; + CARD8 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = BitmapBytePad(pScrn->displayWidth * 24); + srcPitch = -pSiS->Rotate * pSiS->ShadowPitch; + + while(num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~3; + y2 = (pbox->y2 + 3) & ~3; + height = (y2 - y1) >> 2; /* blocks of 3 dwords */ + + if(pSiS->Rotate == 1) { + dstPtr = pSiS->FbBase + + (pbox->x1 * dstPitch) + ((pScrn->virtualX - y2) * 3); + srcPtr = pSiS->ShadowPtr + ((1 - y2) * srcPitch) + (pbox->x1 * 3); + } else { + dstPtr = pSiS->FbBase + + ((pScrn->virtualY - pbox->x2) * dstPitch) + (y1 * 3); + srcPtr = pSiS->ShadowPtr + (y1 * srcPitch) + (pbox->x2 * 3) - 3; + } + + while(width--) { + src = srcPtr; + dst = (CARD32*)dstPtr; + count = height; + while(count--) { + dst[0] = src[0] | (src[1] << 8) | (src[2] << 16) | + (src[srcPitch] << 24); + dst[1] = src[srcPitch + 1] | (src[srcPitch + 2] << 8) | + (src[srcPitch * 2] << 16) | + (src[(srcPitch * 2) + 1] << 24); + dst[2] = src[(srcPitch * 2) + 2] | (src[srcPitch * 3] << 8) | + (src[(srcPitch * 3) + 1] << 16) | + (src[(srcPitch * 3) + 2] << 24); + dst += 3; + src += srcPitch * 4; + } + srcPtr += pSiS->Rotate * 3; + dstPtr += dstPitch; + } + + pbox++; + } +} + +void +SISRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + SISPtr pSiS = SISPTR(pScrn); + int count, width, height, dstPitch, srcPitch; + CARD32 *dstPtr, *srcPtr, *src, *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -pSiS->Rotate * pSiS->ShadowPitch >> 2; + + while(num--) { + width = pbox->x2 - pbox->x1; + height = pbox->y2 - pbox->y1; + + if(pSiS->Rotate == 1) { + dstPtr = (CARD32*)pSiS->FbBase + + (pbox->x1 * dstPitch) + pScrn->virtualX - pbox->y2; + srcPtr = (CARD32*)pSiS->ShadowPtr + + ((1 - pbox->y2) * srcPitch) + pbox->x1; + } else { + dstPtr = (CARD32*)pSiS->FbBase + + ((pScrn->virtualY - pbox->x2) * dstPitch) + pbox->y1; + srcPtr = (CARD32*)pSiS->ShadowPtr + + (pbox->y1 * srcPitch) + pbox->x2 - 1; + } + + while(width--) { + src = srcPtr; + dst = dstPtr; + count = height; + while(count--) { + *(dst++) = *src; + src += srcPitch; + } + srcPtr += pSiS->Rotate; + dstPtr += dstPitch; + } + + pbox++; + } +} diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.h new file mode 100644 index 000000000..b44922131 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.h @@ -0,0 +1,8 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.h,v 1.2 2001/04/19 14:11:37 alanh Exp $ */ + +void SISPointerMoved(int index, int x, int y); +void SISRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void SISRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void SISRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void SISRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void SISRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c index 371e43435..beb712fac 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c,v 1.2 2000/12/02 01:16:18 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c,v 1.3 2001/04/19 12:40:33 alanh Exp $ */ #include "xf86.h" #include "xf86_ansic.h" @@ -11,62 +11,62 @@ void SISLCDPreInit(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); - int temp; + SISPtr pSiS = SISPTR(pScrn); + int temp; - - if (!(pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL))) - return; + + if (!(pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL))) + return; - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, temp); - if (temp & 0x08) + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, temp); + if (temp & 0x08) pSiS->VBFlags |= CRT2_LCD; - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x36, temp); - if (temp == 1) - pSiS->VBFlags |= LCD_800x600; - if (temp == 2) - pSiS->VBFlags |= LCD_1024x768; - if (temp == 3) - pSiS->VBFlags |= LCD_1280x1024; + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x36, temp); + if (temp == 1) + pSiS->VBFlags |= LCD_800x600; + if (temp == 2) + pSiS->VBFlags |= LCD_1024x768; + if (temp == 3) + pSiS->VBFlags |= LCD_1280x1024; } void SISTVPreInit(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); - int temp; + SISPtr pSiS = SISPTR(pScrn); + int temp; - if (!(pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL))) - return; + if (!(pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL))) + return; - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, temp); - if (temp & 0x04) - pSiS->VBFlags |= (CRT2_TV | TV_SCART); - else if (temp & 0x02) - pSiS->VBFlags |= (CRT2_TV | TV_SVIDEO); - else if (temp & 0x01) - pSiS->VBFlags |= (CRT2_TV | TV_AVIDEO); - else if (temp & 0x40) - pSiS->VBFlags |= (CRT2_TV | TV_HIVISION); - return; + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, temp); + if (temp & 0x04) + pSiS->VBFlags |= (CRT2_TV | TV_SCART); + else if (temp & 0x02) + pSiS->VBFlags |= (CRT2_TV | TV_SVIDEO); + else if (temp & 0x01) + pSiS->VBFlags |= (CRT2_TV | TV_AVIDEO); + else if (temp & 0x40) + pSiS->VBFlags |= (CRT2_TV | TV_HIVISION); + return; - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x31, temp); - if (temp & 0x01) - pSiS->VBFlags |= TV_PAL; - else - pSiS->VBFlags |= TV_NTSC; + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x31, temp); + if (temp & 0x01) + pSiS->VBFlags |= TV_PAL; + else + pSiS->VBFlags |= TV_NTSC; } void SISCRT2PreInit(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); - int temp; + SISPtr pSiS = SISPTR(pScrn); + int temp; - if (!(pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL))) - return; + if (!(pSiS->VBFlags & (VB_301|VB_302|VB_303|VB_LVDS|VB_CHRONTEL))) + return; - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, temp); - if (temp & 0x10) + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x32, temp); + if (temp & 0x10) pSiS->VBFlags |= CRT2_VGA; return; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h index bd374e186..a47cc5446 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h @@ -1,39 +1,33 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h,v 1.3 2000/12/02 01:16:18 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h,v 1.4 2001/04/19 12:40:33 alanh Exp $ */ /* CR30 VBInfo = CR31:CR30 */ -#define SET_SIMU_SCAN_MODE 0x0001 -#define SWITCH_TO_CRT2 0x0002 -#define SET_CRT2_TO_AVIDEO 0x0004 /* Composite */ -#define SET_CRT2_TO_SVIDEO 0x0008 -#define SET_CRT2_TO_SCART 0x0010 -#define SET_CRT2_TO_LCD 0x0020 -#define SET_CRT2_TO_RAMDAC 0x0040 -#define SET_CRT2_TO_HIVISION_TV 0x0080 -#define SET_CRT2_TO_TV (SET_CRT2_TO_AVIDEO | SET_CRT2_TO_SVIDEO | \ - SET_CRT2_TO_SCART | SET_CRT2_TO_HIVISION_TV) +#define SET_SIMU_SCAN_MODE 0x0001 +#define SWITCH_TO_CRT2 0x0002 +#define SET_CRT2_TO_AVIDEO 0x0004 /* Composite */ +#define SET_CRT2_TO_SVIDEO 0x0008 +#define SET_CRT2_TO_SCART 0x0010 +#define SET_CRT2_TO_LCD 0x0020 +#define SET_CRT2_TO_RAMDAC 0x0040 +#define SET_CRT2_TO_HIVISION_TV 0x0080 +#define SET_CRT2_TO_TV (SET_CRT2_TO_AVIDEO | SET_CRT2_TO_SVIDEO | \ + SET_CRT2_TO_SCART | SET_CRT2_TO_HIVISION_TV) /* CR31 */ -#define SET_PAL_TV 0x0100 -#define SET_IN_SLAVE_MODE 0x0200 -#define SET_NO_SIMU_ON_LOCK 0x0400 -#define SET_NO_SIMU_TV_ON_LOCK SET_NO_SIMU_ON_LOCK -#define DISABLE_LOAD_CRT2DAC 0x1000 -#define DISABLE_CRT2_DISPLAY 0x2000 -#define DRIVER_MODE 0x4000 +#define SET_PAL_TV 0x0100 +#define SET_IN_SLAVE_MODE 0x0200 +#define SET_NO_SIMU_ON_LOCK 0x0400 +#define SET_NO_SIMU_TV_ON_LOCK SET_NO_SIMU_ON_LOCK +#define DISABLE_LOAD_CRT2DAC 0x1000 +#define DISABLE_CRT2_DISPLAY 0x2000 +#define DRIVER_MODE 0x4000 -Bool SiSSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode); -void SetBlock(CARD16 port, CARD8 from, CARD8 to, CARD8 *DataPtr); - -extern void EnableBridge(unsigned short); -extern void DisableBridge(unsigned short); -extern void LockCRT2(unsigned short); -extern void UnLockCRT2(unsigned short); -extern void SetCH7005(unsigned short); -extern unsigned short GetCH7005(unsigned short); - -typedef struct _SiS301Reg { - CARD8 *VBPart1; - CARD8 *VBPart2; - CARD8 *VBPart3; - CARD8 *VBPart4; +typedef struct _SiS301Reg { + CARD8 *VBPart1; + CARD8 *VBPart2; + CARD8 *VBPart3; + CARD8 *VBPart4; } SiS301RegRec, SiS301RegPtr; + +void SISLCDPreInit(ScrnInfoPtr pScrn); +void SISTVPreInit(ScrnInfoPtr pScrn); +void SISCRT2PreInit(ScrnInfoPtr pScrn); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c index 25d95725a..579986d67 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c @@ -25,7 +25,7 @@ * Mitani Hiroshi <hmitani@drl.mei.co.jp> * David Thomas <davtom@dream.org.uk>. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c,v 1.6 2000/12/02 01:16:18 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c,v 1.7 2001/04/19 12:40:33 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -34,12 +34,9 @@ #include "xf86PciInfo.h" #include "xf86Pci.h" -#include "vgaHW.h" - #include "sis.h" #include "sis_regs.h" -#include "sis_vb.h" - +#include "sis_dac.h" #define Midx 0 #define Nidx 1 @@ -56,10 +53,10 @@ #define TOLERANCE 0.01 /* search smallest M and N in this tolerance */ +void SISVGAPreInit(ScrnInfoPtr pScrn); static Bool SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode); static Bool SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode); - static Bool SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { @@ -162,48 +159,48 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode) case PCI_CHIP_SIS6326: pReg->sisRegs3C4[LinearAdd0] = (pSiS->FbAddress & 0x07F80000) >> 19; pReg->sisRegs3C4[LinearAdd1] =((pSiS->FbAddress & 0xF8000000) >> 27) - | temp; /* Enable linear with max 4M */ + | temp; /* Enable linear with max 4M */ break; case PCI_CHIP_SIS530: pReg->sisRegs3C4[LinearAdd0] = (pSiS->FbAddress & 0x07F80000) >> 19; pReg->sisRegs3C4[LinearAdd1] =((pSiS->FbAddress & 0xF8000000) >> 27) - | temp; /* Enable linear with max 8M */ + | temp; /* Enable linear with max 8M */ break; } - /* Screen Offset */ - vgaReg->CRTC[0x13] = offset & 0xFF; - pReg->sisRegs3C4[CRTCOff] = ((offset & 0xF00) >> 4) | - (((mode->CrtcVTotal-2) & 0x400) >> 10 ) | - (((mode->CrtcVDisplay-1) & 0x400) >> 9 ) | - (((mode->CrtcVSyncStart-1) & 0x400) >> 8 ) | - (((mode->CrtcVSyncStart) & 0x400) >> 7 ) ; - - /* Extended Horizontal Overflow Register */ - pReg->sisRegs3C4[0x12] &= 0xE0; - pReg->sisRegs3C4[0x12] |= ( - (((mode->CrtcHTotal >> 3) - 5) & 0x100) >> 8 | - (((mode->CrtcHDisplay >> 3) - 1) & 0x100) >> 7 | - (((mode->CrtcHSyncStart >> 3) - 1) & 0x100) >> 6 | - ((mode->CrtcHSyncStart >> 3) & 0x100) >> 5 | - (((mode->CrtcHBlankEnd >> 3) -1) & 0x40) >> 2); -/* ((mode->CrtcHSyncEnd >> 3) & 0x40) >> 2); */ - - if (mode->CrtcVDisplay > 1024) - /* disable line compare */ - pReg->sisRegs3C4[0x38] |= 0x04; - else - pReg->sisRegs3C4[0x38] &= 0xFB; - - if (( pScrn->depth == 24) || (pScrn->depth == 32) || - (mode->CrtcHDisplay >= 1280)) - /* Enable high speed DCLK */ - pReg->sisRegs3C4[0x3E] |= 1; - else - pReg->sisRegs3C4[0x3E] &= 0xFE; - - - /* Set vclk */ + /* Screen Offset */ + vgaReg->CRTC[0x13] = offset & 0xFF; + pReg->sisRegs3C4[CRTCOff] = ((offset & 0xF00) >> 4) | + (((mode->CrtcVTotal-2) & 0x400) >> 10 ) | + (((mode->CrtcVDisplay-1) & 0x400) >> 9 ) | + (((mode->CrtcVSyncStart-1) & 0x400) >> 8 ) | + (((mode->CrtcVSyncStart) & 0x400) >> 7 ) ; + + /* Extended Horizontal Overflow Register */ + pReg->sisRegs3C4[0x12] &= 0xE0; + pReg->sisRegs3C4[0x12] |= ( + (((mode->CrtcHTotal >> 3) - 5) & 0x100) >> 8 | + (((mode->CrtcHDisplay >> 3) - 1) & 0x100) >> 7 | + (((mode->CrtcHSyncStart >> 3) - 1) & 0x100) >> 6 | + ((mode->CrtcHSyncStart >> 3) & 0x100) >> 5 | + (((mode->CrtcHBlankEnd >> 3) -1) & 0x40) >> 2); +/* ((mode->CrtcHSyncEnd >> 3) & 0x40) >> 2); */ + + if (mode->CrtcVDisplay > 1024) + /* disable line compare */ + pReg->sisRegs3C4[0x38] |= 0x04; + else + pReg->sisRegs3C4[0x38] &= 0xFB; + + if (( pScrn->depth == 24) || (pScrn->depth == 32) || + (mode->CrtcHDisplay >= 1280)) + /* Enable high speed DCLK */ + pReg->sisRegs3C4[0x3E] |= 1; + else + pReg->sisRegs3C4[0x3E] &= 0xFE; + + + /* Set vclk */ if (compute_vclk(clock, &num, &denum, &div, &sbit, &scale)) { switch (pSiS->Chipset) { case PCI_CHIP_SIS5597: @@ -218,7 +215,7 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->sisRegs3C4[ClockBase] |= 0x40; else pReg->sisRegs3C4[ClockBase] &= 0xBF; - + break; } } @@ -249,10 +246,10 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode) } } /* end of set vclk */ - if (clock > 135000) - pReg->sisRegs3C4[ClockReg] |= 0x02; + if (clock > 135000) + pReg->sisRegs3C4[ClockReg] |= 0x02; - /*pReg->sisRegs3C2 = inb(0x3CC) | 0x0C;*/ /* Programmable Clock */ + /* pReg->sisRegs3C2 = inb(0x3CC) | 0x0C;*/ /* Programmable Clock */ pReg->sisRegs3C2 = inb(pSiS->RelIO+0x4c) | 0x0C; /* Programmable Clock */ if (pSiS->FastVram && ((pSiS->Chipset == PCI_CHIP_SIS530) || @@ -304,7 +301,7 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->sisRegs3C4[GraphEng] |= 0x40; if (pSiS->TurboQueue) { pReg->sisRegs3C4[GraphEng] |= 0x80; - /* All Queue for 2D */ + /* All Queue for 2D */ pReg->sisRegs3C4[ExtMiscCont9] &= 0xFC; if (pSiS->HWCursor) pReg->sisRegs3C4[TurboQueueBase] = (pScrn->videoRam/32) - 2; @@ -324,7 +321,7 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->sisRegs3C4[MemClock0] = (vclk[Midx] - 1) & 0x7f ; pReg->sisRegs3C4[MemClock0] |= ((vclk[VLDidx] == 2 ) ? 1 : 0 ) << 7 ; - pReg->sisRegs3C4[MemClock1] = (vclk[Nidx] -1) & 0x1f ; /* bits [4:0] contain denumerator -MC */ + pReg->sisRegs3C4[MemClock1] = (vclk[Nidx] -1) & 0x1f ; /* bits [4:0] contain denumerator -MC */ if (vclk[Pidx] <= 4){ pReg->sisRegs3C4[MemClock1] |= (vclk[Pidx] -1 ) << 5 ; /* postscale 1,2,3,4 */ pReg->sisRegs3C4[ClockBase] &= 0x7F; @@ -352,41 +349,42 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode) /* set threshold value */ switch (pSiS->Chipset) { - case PCI_CHIP_SIS5597: - case PCI_CHIP_SIS6326: - MemBand = sisMemBandWidth(pScrn) / 10 ; - safetymargin = 1; - gap = 4; - - CRT_ENGthreshold = 0x0F; - CRT_CPUthresholdLow = ((pScrn->depth*clock) / MemBand)+safetymargin; - CRT_CPUthresholdHigh =((pScrn->depth*clock) / MemBand)+gap+safetymargin; - - if ( CRT_CPUthresholdLow > (pScrn->depth < 24 ? 0xe:0x0d) ) { - CRT_CPUthresholdLow = (pScrn->depth < 24 ? 0xe:0x0d); - } + case PCI_CHIP_SIS5597: + case PCI_CHIP_SIS6326: + MemBand = SiSMemBandWidth(pScrn) / 10 ; + safetymargin = 1; + gap = 4; + + CRT_ENGthreshold = 0x0F; + CRT_CPUthresholdLow = ((pScrn->depth*clock) / + MemBand)+safetymargin; + CRT_CPUthresholdHigh =((pScrn->depth*clock) / + MemBand)+gap+safetymargin; + + if ( CRT_CPUthresholdLow > (pScrn->depth < 24 ? 0xe:0x0d) ) { + CRT_CPUthresholdLow = (pScrn->depth < 24 ? 0xe:0x0d); + } - if ( CRT_CPUthresholdHigh > (pScrn->depth < 24 ? 0x10:0x0f) ) { - CRT_CPUthresholdHigh = (pScrn->depth < 24 ? 0x10:0x0f); - } + if ( CRT_CPUthresholdHigh > (pScrn->depth < 24 ? 0x10:0x0f) ) { + CRT_CPUthresholdHigh = (pScrn->depth < 24 ? 0x10:0x0f); + } - pReg->sisRegs3C4[CPUThreshold] = (CRT_ENGthreshold & 0x0F) | - (CRT_CPUthresholdLow & 0x0F)<<4 ; - pReg->sisRegs3C4[CRTThreshold] = CRT_CPUthresholdHigh & 0x0F; + pReg->sisRegs3C4[CPUThreshold] = (CRT_ENGthreshold & 0x0F) | + (CRT_CPUthresholdLow & 0x0F)<<4 ; + pReg->sisRegs3C4[CRTThreshold] = CRT_CPUthresholdHigh & 0x0F; - break; - case PCI_CHIP_SIS530: - (*pSiS->SetThreshold)(pScrn, mode, &CRT_CPUthresholdLow, - &CRT_CPUthresholdHigh); - pReg->sisRegs3C4[8] = (CRT_CPUthresholdLow & 0xf) << 4 | 0xF; - pReg->sisRegs3C4[9] &= 0xF0; - pReg->sisRegs3C4[9] |= (CRT_CPUthresholdHigh & 0xF); - /*pReg->sisRegs3C4[0x3F] &= 0xE3;*/ - pReg->sisRegs3C4[0x3F] &= 0xE3; - pReg->sisRegs3C4[0x3F] |= (CRT_CPUthresholdHigh & 0x10) | - (CRT_CPUthresholdLow & 0x10) >> 2 | - 0x08; - break; + break; + case PCI_CHIP_SIS530: + (*pSiS->SetThreshold)(pScrn, mode, &CRT_CPUthresholdLow, + &CRT_CPUthresholdHigh); + pReg->sisRegs3C4[8] = (CRT_CPUthresholdLow & 0xf) << 4 | 0xF; + pReg->sisRegs3C4[9] &= 0xF0; + pReg->sisRegs3C4[9] |= (CRT_CPUthresholdHigh & 0xF); + pReg->sisRegs3C4[0x3F] &= 0xE3; + pReg->sisRegs3C4[0x3F] |= (CRT_CPUthresholdHigh & 0x10) | + (CRT_CPUthresholdLow & 0x10) >> 2 | + 0x08; + break; } return(TRUE); @@ -395,227 +393,225 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode) Bool SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode) { - SISPtr pSiS = SISPTR(pScrn); - SISRegPtr pReg = &pSiS->ModeReg; - vgaRegPtr vgaReg = &VGAHWPTR(pScrn)->ModeReg; - int vgaIOBase; - unsigned short temp; - int offset; - int clock = mode->Clock; - unsigned int vclk[5]; - - int num, denum, div, sbit, scale; - unsigned short Threshold_Low, Threshold_High; - - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "SIS300Init()\n"); - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, - "virtualX = %d depth = %d Logical width = %d\n", - pScrn->virtualX, pScrn->bitsPerPixel, - pScrn->virtualX * pScrn->bitsPerPixel/8); + SISPtr pSiS = SISPTR(pScrn); + SISRegPtr pReg = &pSiS->ModeReg; + vgaRegPtr vgaReg = &VGAHWPTR(pScrn)->ModeReg; + int vgaIOBase; + unsigned short temp; + int offset; + int clock = mode->Clock; + unsigned int vclk[5]; + + int num, denum, div, sbit, scale; + unsigned short Threshold_Low, Threshold_High; - vgaHWGetIOBase(VGAHWPTR(pScrn)); - vgaIOBase = VGAHWPTR(pScrn)->IOBase; + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "SIS300Init()\n"); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, + "virtualX = %d depth = %d Logical width = %d\n", + pScrn->virtualX, pScrn->bitsPerPixel, + pScrn->virtualX * pScrn->bitsPerPixel/8); - (*pSiS->SiSSave)(pScrn, pReg); + vgaHWGetIOBase(VGAHWPTR(pScrn)); + vgaIOBase = VGAHWPTR(pScrn)->IOBase; + + (*pSiS->SiSSave)(pScrn, pReg); - outw(VGA_SEQ_INDEX, 0x8605); + outw(VGA_SEQ_INDEX, 0x8605); - pReg->sisRegs3C4[6] &= ~GENMASK(4:2); + pReg->sisRegs3C4[6] &= ~GENMASK(4:2); - switch (pScrn->bitsPerPixel) { + switch (pScrn->bitsPerPixel) { case 8: - pSiS->DstColor = 0x0000; - pReg->sisRegs3C4[6] |= 0x03; - break; + pSiS->DstColor = 0x0000; + pReg->sisRegs3C4[6] |= 0x03; + break; case 16: - if (pScrn->depth==15) { - pSiS->DstColor = 0x4000; - pReg->sisRegs3C4[6] |= ((1 << 2) | 0x03); - } else { - pSiS->DstColor = (short) 0x8000; - pReg->sisRegs3C4[6] |= ((2 << 2) | 0x03); - } - break; + if (pScrn->depth==15) { + pSiS->DstColor = 0x4000; + pReg->sisRegs3C4[6] |= ((1 << 2) | 0x03); + } else { + pSiS->DstColor = (short) 0x8000; + pReg->sisRegs3C4[6] |= ((2 << 2) | 0x03); + } + break; case 24: - pReg->sisRegs3C4[6] |= ((3 << 2) | 0x03); - break; + pReg->sisRegs3C4[6] |= ((3 << 2) | 0x03); + break; case 32: - pSiS->DstColor = (short) 0xC000; - pReg->sisRegs3C4[6] |= ((4 << 2) | 0x03); - break; - } + pSiS->DstColor = (short) 0xC000; + pReg->sisRegs3C4[6] |= ((4 << 2) | 0x03); + break; + } - pSiS->scrnOffset = pScrn->displayWidth * ((pScrn->bitsPerPixel+7)/8); + pSiS->scrnOffset = pScrn->displayWidth * ((pScrn->bitsPerPixel+7)/8); - pReg->sisRegs3D4[0x19] = 0; - pReg->sisRegs3D4[0x1A] &= 0xFC; + pReg->sisRegs3D4[0x19] = 0; + pReg->sisRegs3D4[0x1A] &= 0xFC; - if (mode->Flags & V_INTERLACE) { - offset = pSiS->scrnOffset >> 2; - pReg->sisRegs3C4[0x06] |= 0x20; - if (pSiS->Chipset != PCI_CHIP_SIS300) { - temp = (mode->CrtcHSyncStart >> 3) - - (mode->CrtcHTotal >> 3)/2; - pReg->sisRegs3D4[0x19] = GETVAR8(temp); - pReg->sisRegs3D4[0x1A] |= GETBITS(temp, 9:8); - } - } else { - offset = pSiS->scrnOffset >> 3; - pReg->sisRegs3C4[0x06] &= ~0x20; - } - - pReg->sisRegs3C4[0x07] |= 0x10; /* enable High Speed DAC */ - pReg->sisRegs3C4[0x07] &= 0xFC; - if (clock < 100000) - pReg->sisRegs3C4[0x07] |= 0x03; - else if (clock < 200000) - pReg->sisRegs3C4[0x07] |= 0x02; - else if (clock < 250000) - pReg->sisRegs3C4[0x07] |= 0x01; - - /* Extended Vertical Overflow */ - pReg->sisRegs3C4[0x0A] = - GETBITSTR(mode->CrtcVTotal -2, 10:10, 0:0) | - GETBITSTR(mode->CrtcVDisplay -1, 10:10, 1:1) | - GETBITSTR(mode->CrtcVBlankStart , 10:10, 2:2) | - GETBITSTR(mode->CrtcVSyncStart , 10:10, 3:3) | - GETBITSTR(mode->CrtcVBlankEnd , 8:8, 4:4) | - GETBITSTR(mode->CrtcVSyncEnd , 4:4, 5:5) ; - - /* Extended Horizontal Overflow */ - pReg->sisRegs3C4[0x0B] = - GETBITSTR((mode->CrtcHTotal >> 3) - 5, 9:8, 1:0) | - GETBITSTR((mode->CrtcHDisplay >> 3) - 1, 9:8, 3:2) | - GETBITSTR((mode->CrtcHBlankStart >> 3) , 9:8, 5:4) | - GETBITSTR((mode->CrtcHSyncStart >> 3) , 9:8, 7:6) ; - - pReg->sisRegs3C4[0x0C] &= 0xF8; - pReg->sisRegs3C4[0x0C] |= - GETBITSTR(mode->CrtcHBlankEnd >> 3, 7:6, 1:0) | - GETBITSTR(mode->CrtcHSyncEnd >> 3, 5:5, 2:2) ; - - /* Screen Offset */ - vgaReg->CRTC[0x13] = GETVAR8(offset); - pReg->sisRegs3C4[0x0E] &= 0xF0; - pReg->sisRegs3C4[0x0E] |= GETBITS(offset, 11:8); - - /* line compare */ - if (mode->CrtcHDisplay > 0) - pReg->sisRegs3C4[0x0F] |= 0x08; - else - pReg->sisRegs3C4[0x0F] &= 0xF7; - - pReg->sisRegs3C4[0x10] = - ((mode->CrtcHDisplay *((pScrn->bitsPerPixel+7)/8) + 63) >> 6)+1; - - /* Enable Linear */ - pReg->sisRegs3C4[0x20] |= 0x81; - - - /* Set vclk */ + if (mode->Flags & V_INTERLACE) { + offset = pSiS->scrnOffset >> 2; + pReg->sisRegs3C4[0x06] |= 0x20; + if (pSiS->Chipset != PCI_CHIP_SIS300) { + temp = (mode->CrtcHSyncStart >> 3) - + (mode->CrtcHTotal >> 3)/2; + pReg->sisRegs3D4[0x19] = GETVAR8(temp); + pReg->sisRegs3D4[0x1A] |= GETBITS(temp, 9:8); + } + } else { + offset = pSiS->scrnOffset >> 3; + pReg->sisRegs3C4[0x06] &= ~0x20; + } + + pReg->sisRegs3C4[0x07] |= 0x10; /* enable High Speed DAC */ + pReg->sisRegs3C4[0x07] &= 0xFC; + if (clock < 100000) + pReg->sisRegs3C4[0x07] |= 0x03; + else if (clock < 200000) + pReg->sisRegs3C4[0x07] |= 0x02; + else if (clock < 250000) + pReg->sisRegs3C4[0x07] |= 0x01; + + /* Extended Vertical Overflow */ + pReg->sisRegs3C4[0x0A] = + GETBITSTR(mode->CrtcVTotal -2, 10:10, 0:0) | + GETBITSTR(mode->CrtcVDisplay -1, 10:10, 1:1) | + GETBITSTR(mode->CrtcVBlankStart , 10:10, 2:2) | + GETBITSTR(mode->CrtcVSyncStart , 10:10, 3:3) | + GETBITSTR(mode->CrtcVBlankEnd , 8:8, 4:4) | + GETBITSTR(mode->CrtcVSyncEnd , 4:4, 5:5) ; + + /* Extended Horizontal Overflow */ + pReg->sisRegs3C4[0x0B] = + GETBITSTR((mode->CrtcHTotal >> 3) - 5, 9:8, 1:0) | + GETBITSTR((mode->CrtcHDisplay >> 3) - 1, 9:8, 3:2) | + GETBITSTR((mode->CrtcHBlankStart >> 3) , 9:8, 5:4) | + GETBITSTR((mode->CrtcHSyncStart >> 3) , 9:8, 7:6) ; + + pReg->sisRegs3C4[0x0C] &= 0xF8; + pReg->sisRegs3C4[0x0C] |= + GETBITSTR(mode->CrtcHBlankEnd >> 3, 7:6, 1:0) | + GETBITSTR(mode->CrtcHSyncEnd >> 3, 5:5, 2:2) ; + + /* Screen Offset */ + vgaReg->CRTC[0x13] = GETVAR8(offset); + pReg->sisRegs3C4[0x0E] &= 0xF0; + pReg->sisRegs3C4[0x0E] |= GETBITS(offset, 11:8); + + /* line compare */ + if (mode->CrtcHDisplay > 0) + pReg->sisRegs3C4[0x0F] |= 0x08; + else + pReg->sisRegs3C4[0x0F] &= 0xF7; + + pReg->sisRegs3C4[0x10] = + ((mode->CrtcHDisplay *((pScrn->bitsPerPixel+7)/8) + 63) >> 6)+1; + + /* Enable Linear */ + pReg->sisRegs3C4[0x20] |= 0x81; + + /* Set vclk */ if (compute_vclk(clock, &num, &denum, &div, &sbit, &scale)) { - pReg->sisRegs3C4[0x2B] = (num -1) & 0x7f; - if (div == 2) - pReg->sisRegs3C4[0x2B] |= 0x80; - pReg->sisRegs3C4[0x2C] = ((denum -1) & 0x1f); - pReg->sisRegs3C4[0x2C] |= (((scale-1)&3) << 5); - if (sbit) - pReg->sisRegs3C4[0x2C] |= 0x80; - pReg->sisRegs3C4[0x2D] = 0x80; + pReg->sisRegs3C4[0x2B] = (num -1) & 0x7f; + if (div == 2) + pReg->sisRegs3C4[0x2B] |= 0x80; + pReg->sisRegs3C4[0x2C] = ((denum -1) & 0x1f); + pReg->sisRegs3C4[0x2C] |= (((scale-1)&3) << 5); + if (sbit) + pReg->sisRegs3C4[0x2C] |= 0x80; + pReg->sisRegs3C4[0x2D] = 0x80; } - else { + else { /* if compute_vclk cannot handle the request clock try sisCalcClock! */ SiSCalcClock(pScrn, clock, 2, vclk); - pReg->sisRegs3C4[0x2B] = (vclk[Midx] - 1) & 0x7f ; - pReg->sisRegs3C4[0x2B] |= ((vclk[VLDidx] == 2 ) ? 1 : 0 ) << 7 ; + pReg->sisRegs3C4[0x2B] = (vclk[Midx] - 1) & 0x7f ; + pReg->sisRegs3C4[0x2B] |= ((vclk[VLDidx] == 2 ) ? 1 : 0 ) << 7 ; - /* bits [4:0] contain denumerator -MC */ - pReg->sisRegs3C4[0x2C] = (vclk[Nidx] -1) & 0x1f ; + /* bits [4:0] contain denumerator -MC */ + pReg->sisRegs3C4[0x2C] = (vclk[Nidx] -1) & 0x1f ; - if (vclk[Pidx] <= 4) { - /* postscale 1,2,3,4 */ - pReg->sisRegs3C4[0x2C] |= (vclk[Pidx] -1 ) << 5 ; - pReg->sisRegs3C4[0x2C] &= 0x7F; - } else { - /* postscale 6,8 */ - pReg->sisRegs3C4[0x2C] |= ((vclk[Pidx] / 2) -1 ) << 5 ; - pReg->sisRegs3C4[0x2C] |= 0x80; - } - pReg->sisRegs3C4[0x2D] = 0x80; + if (vclk[Pidx] <= 4) { + /* postscale 1,2,3,4 */ + pReg->sisRegs3C4[0x2C] |= (vclk[Pidx] -1 ) << 5 ; + pReg->sisRegs3C4[0x2C] &= 0x7F; + } else { + /* postscale 6,8 */ + pReg->sisRegs3C4[0x2C] |= ((vclk[Pidx] / 2) -1 ) << 5 ; + pReg->sisRegs3C4[0x2C] |= 0x80; + } + pReg->sisRegs3C4[0x2D] = 0x80; } /* end of set vclk */ - if (clock > 150000) { /* enable two-pixel mode */ - pReg->sisRegs3C4[0x07] |= 0x80; - pReg->sisRegs3C4[0x32] |= 0x08; - } else { - pReg->sisRegs3C4[0x07] &= 0x7F; - pReg->sisRegs3C4[0x32] &= 0xF7; - } - - /*pReg->sisRegs3C2 = inb(0x3CC) | 0x0C;*/ /* Programmable Clock */ - pReg->sisRegs3C2 = inb(pSiS->RelIO+0x4c) | 0x0C; /*Programmable Clock*/ - - if (!pSiS->NoAccel) { - pReg->sisRegs3C4[0x1E] |= 0x42; - if (pSiS->TurboQueue) { /* set Turbo Queue as 512k */ - temp = ((pScrn->videoRam/64)-4); - pReg->sisRegs3C4[0x26] = temp & 0xFF; - pReg->sisRegs3C4[0x27] = ((temp >> 8) & 3) || 0xF0; - } - } + if (clock > 150000) { /* enable two-pixel mode */ + pReg->sisRegs3C4[0x07] |= 0x80; + pReg->sisRegs3C4[0x32] |= 0x08; + } else { + pReg->sisRegs3C4[0x07] &= 0x7F; + pReg->sisRegs3C4[0x32] &= 0xF7; + } + + pReg->sisRegs3C2 = inb(0x3CC) | 0x0C; /* Programmable Clock */ + + if (!pSiS->NoAccel) { + pReg->sisRegs3C4[0x1E] |= 0x42; + if (pSiS->TurboQueue) { /* set Turbo Queue as 512k */ + temp = ((pScrn->videoRam/64)-4); + pReg->sisRegs3C4[0x26] = temp & 0xFF; + pReg->sisRegs3C4[0x27] = ((temp >> 8) & 3) || 0xF0; + } + } - /* set threshold value */ - (*pSiS->SetThreshold)(pScrn, mode, &Threshold_Low, &Threshold_High); - pReg->sisRegs3C4[0x08] = GETBITSTR(Threshold_Low, 3:0, 7:4) | 0xF; - pReg->sisRegs3C4[0x0F] &= ~GENMASK(5:5); - pReg->sisRegs3C4[0x0F] |= GETBITSTR(Threshold_Low, 4:4, 5:5); - pReg->sisRegs3C4[0x09] &= ~GENMASK(3:0); - pReg->sisRegs3C4[0x09] |= GETBITS(Threshold_High, 3:0); + /* set threshold value */ + (*pSiS->SetThreshold)(pScrn, mode, &Threshold_Low, &Threshold_High); + pReg->sisRegs3C4[0x08] = GETBITSTR(Threshold_Low, 3:0, 7:4) | 0xF; + pReg->sisRegs3C4[0x0F] &= ~GENMASK(5:5); + pReg->sisRegs3C4[0x0F] |= GETBITSTR(Threshold_Low, 4:4, 5:5); + pReg->sisRegs3C4[0x09] &= ~GENMASK(3:0); + pReg->sisRegs3C4[0x09] |= GETBITS(Threshold_High, 3:0); - return(TRUE); + return(TRUE); } void SISVGAPreInit(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); - int temp; - unsigned short usOffsetHigh, usOffsetLow, vBiosVersion; - unsigned long ROMAddr = (unsigned long) SISPTR(pScrn)->BIOS; - - usOffsetHigh = *((unsigned char *)(ROMAddr+0x08)) - 0x30; - usOffsetLow = *((unsigned char *)(ROMAddr+0x09)) - 0x30; - vBiosVersion = usOffsetHigh << 4 | usOffsetLow; - if(vBiosVersion < 0x02) - { - outSISIDXREG(pSiS->RelIO+CROFFSET, 0x37, 0); - inSISIDXREG(pSiS->RelIO+CROFFSET, 0x36, temp); - temp &= 0x07; - outSISIDXREG(pSiS->RelIO+CROFFSET, 0x36, temp); - } - outb(SISPART4, 0x00); - temp = inb(SISPART4+1) & 0x0F; - pSiS->VBFlags = 0; /*reset*/ - if (temp == 1) - pSiS->VBFlags|=VB_301; /*301*/ - else if (temp == 2) - pSiS->VBFlags|=VB_302; /*302*/ - else if (temp == 3) - pSiS->VBFlags|=VB_303; /*303*/ - else - { - outb(SISCR, 0x37); - temp = ((inb(SISCR+1))>>1) & 0x07; - if ((temp==2) || (temp==3) || (temp==4)) pSiS->VBFlags|=VB_LVDS; - if (temp==4) pSiS->VBFlags |= VB_CHRONTEL; - } - - switch (pSiS->Chipset) { + SISPtr pSiS = SISPTR(pScrn); + int temp; + unsigned short usOffsetHigh, usOffsetLow, vBiosVersion; + unsigned long ROMAddr = (unsigned long) SISPTR(pScrn)->BIOS; + + usOffsetHigh = *((unsigned char *)(ROMAddr+0x08)) - 0x30; + usOffsetLow = *((unsigned char *)(ROMAddr+0x09)) - 0x30; + vBiosVersion = usOffsetHigh << 4 | usOffsetLow; + if (vBiosVersion < 0x02) { + outSISIDXREG(pSiS->RelIO+CROFFSET, 0x37, 0); + inSISIDXREG(pSiS->RelIO+CROFFSET, 0x36, temp); + temp &= 0x07; + outSISIDXREG(pSiS->RelIO+CROFFSET, 0x36, temp); + } + outb(SISPART4, 0x00); + temp = inb(SISPART4+1) & 0x0F; + pSiS->VBFlags = 0; /*reset*/ + if (temp == 1) + pSiS->VBFlags|=VB_301; /*301*/ + else if (temp == 2) + pSiS->VBFlags|=VB_302; /*302*/ + else if (temp == 3) + pSiS->VBFlags|=VB_303; /*303*/ + else { + outb(SISCR, 0x37); + temp = ((inb(SISCR+1))>>1) & 0x07; + if ((temp == 2) || (temp == 3) || (temp == 4)) + pSiS->VBFlags |= VB_LVDS; + if (temp == 4) + pSiS->VBFlags |= VB_CHRONTEL; + } + + switch (pSiS->Chipset) { case PCI_CHIP_SIS300: case PCI_CHIP_SIS630: case PCI_CHIP_SIS540: - pSiS->ModeInit = SIS300Init; - break; + pSiS->ModeInit = SIS300Init; + break; default: - pSiS->ModeInit = SISInit; - } + pSiS->ModeInit = SISInit; + } } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c index 9c91fd320..00a3ba469 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c @@ -24,7 +24,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/sis/sis_video.c,v 1.1 2000/12/02 01:16:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c,v 1.2 2001/04/19 12:40:33 alanh Exp $ */ /* * sis_video.c: SIS Xv driver. Based on the mga Xv driver by Mark Vojkovich @@ -54,44 +54,43 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xaalocal.h" #include "dixstruct.h" -/* TODO: move to sis_regs.h */ -#include "sis_vidregs.h" +#include "sis_regs.h" -#define OFF_DELAY 200 /* milliseconds */ -#define FREE_DELAY 60000 +#define OFF_DELAY 200 /* milliseconds */ +#define FREE_DELAY 60000 -#define OFF_TIMER 0x01 -#define FREE_TIMER 0x02 -#define CLIENT_VIDEO_ON 0x04 +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 #define TIMER_MASK (OFF_TIMER | FREE_TIMER) +void SISInitVideo(ScreenPtr pScreen); static XF86VideoAdaptorPtr SISSetupImageVideo(ScreenPtr); static void SISStopVideo(ScrnInfoPtr, pointer, Bool); static int SISSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); static int SISGetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); static void SISQueryBestSize(ScrnInfoPtr, Bool, - short, short, short, short, unsigned int *, unsigned int *, pointer); + short, short, short, short, unsigned int *, unsigned int *, pointer); static int SISPutImage( ScrnInfoPtr, - short, short, short, short, short, short, short, short, - int, unsigned char*, short, short, Bool, RegionPtr, pointer); + short, short, short, short, short, short, short, short, + int, unsigned char*, short, short, Bool, RegionPtr, pointer); static int SISQueryImageAttributes(ScrnInfoPtr, - int, unsigned short *, unsigned short *, int *, int *); - + int, unsigned short *, unsigned short *, int *, int *); static void SISBlockHandler(int, pointer, pointer, pointer); #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) static Atom xvBrightness, xvContrast, xvColorKey; -#define IMAGE_MIN_WIDTH 32 -#define IMAGE_MIN_HEIGHT 24 -#define IMAGE_MAX_WIDTH 720 -#define IMAGE_MAX_HEIGHT 576 +#define IMAGE_MIN_WIDTH 32 +#define IMAGE_MIN_HEIGHT 24 +#define IMAGE_MAX_WIDTH 720 +#define IMAGE_MAX_HEIGHT 576 #define DISPMODE_SINGLE1 0x1 #define DISPMODE_SINGLE2 0x2 -#define DISPMODE_MIRROR 0x4 +#define DISPMODE_MIRROR 0x4 /**************************************************************************** * raw register access : these routines directly interact with the sis's @@ -111,99 +110,99 @@ static void _siswrite(SISPtr pSIS, CARD32 reg, CARD32 data) static CARD8 getvideoreg(SISPtr pSIS, CARD8 reg) { - outb (pSIS->RelIO + vi_index_offset, reg); - return inb(pSIS->RelIO + vi_data_offset); + outb (pSIS->RelIO + vi_index_offset, reg); + return inb(pSIS->RelIO + vi_data_offset); } static void setvideoreg(SISPtr pSIS, CARD8 reg, CARD8 data) { - outb (pSIS->RelIO + vi_index_offset, reg); - outb (pSIS->RelIO + vi_data_offset, data); + outb (pSIS->RelIO + vi_index_offset, reg); + outb (pSIS->RelIO + vi_data_offset, data); } static void setvideoregmask(SISPtr pSIS, CARD8 reg, CARD8 data, CARD8 mask) { - CARD8 old; + CARD8 old; - outb (pSIS->RelIO + vi_index_offset, reg); - old = inb(pSIS->RelIO + vi_data_offset); - data = (data & mask) | (old & (~mask)); - outb (pSIS->RelIO + vi_data_offset, data); + outb (pSIS->RelIO + vi_index_offset, reg); + old = inb(pSIS->RelIO + vi_data_offset); + data = (data & mask) | (old & (~mask)); + outb (pSIS->RelIO + vi_data_offset, data); } static CARD8 getsrreg(SISPtr pSIS, CARD8 reg) { - outb (pSIS->RelIO + sr_index_offset, 0x05); - if (inb (pSIS->RelIO + sr_data_offset) != 0xa1) - outb (pSIS->RelIO + sr_data_offset, 0x86); - outb (pSIS->RelIO + sr_index_offset, reg); - return inb(pSIS->RelIO + sr_data_offset); + outb (pSIS->RelIO + sr_index_offset, 0x05); + if (inb (pSIS->RelIO + sr_data_offset) != 0xa1) + outb (pSIS->RelIO + sr_data_offset, 0x86); + outb (pSIS->RelIO + sr_index_offset, reg); + return inb(pSIS->RelIO + sr_data_offset); } static void setsrreg(SISPtr pSIS, CARD8 reg, CARD8 data) { - outb (pSIS->RelIO + sr_index_offset, 0x05); - if (inb (pSIS->RelIO + sr_data_offset) != 0xa1) - outb (pSIS->RelIO + sr_data_offset, 0x86); - outb (pSIS->RelIO + sr_index_offset, reg); - outb (pSIS->RelIO + sr_data_offset, data); + outb (pSIS->RelIO + sr_index_offset, 0x05); + if (inb (pSIS->RelIO + sr_data_offset) != 0xa1) + outb (pSIS->RelIO + sr_data_offset, 0x86); + outb (pSIS->RelIO + sr_index_offset, reg); + outb (pSIS->RelIO + sr_data_offset, data); } static void setsrregmask(SISPtr pSIS, CARD8 reg, CARD8 data, CARD8 mask) { - CARD8 old; - - outb (pSIS->RelIO + sr_index_offset, 0x05); - if (inb (pSIS->RelIO + sr_data_offset) != 0xa1) - outb (pSIS->RelIO + sr_data_offset, 0x86); - outb (pSIS->RelIO + sr_index_offset, reg); - old = inb(pSIS->RelIO + sr_data_offset); - data = (data & mask) | (old & (~mask)); - outb (pSIS->RelIO + sr_data_offset, data); + CARD8 old; + + outb (pSIS->RelIO + sr_index_offset, 0x05); + if (inb (pSIS->RelIO + sr_data_offset) != 0xa1) + outb (pSIS->RelIO + sr_data_offset, 0x86); + outb (pSIS->RelIO + sr_index_offset, reg); + old = inb(pSIS->RelIO + sr_data_offset); + data = (data & mask) | (old & (~mask)); + outb (pSIS->RelIO + sr_data_offset, data); } static CARD8 getsisreg(SISPtr pSIS, CARD8 index_offset, CARD8 reg) { - outb (pSIS->RelIO + index_offset, reg); - return inb(pSIS->RelIO + index_offset+1); + outb (pSIS->RelIO + index_offset, reg); + return inb(pSIS->RelIO + index_offset+1); } static void setsisreg(SISPtr pSIS, CARD8 index_offset, CARD8 reg, CARD8 data) { - outb (pSIS->RelIO + index_offset, reg); - outb (pSIS->RelIO + index_offset+1, data); + outb (pSIS->RelIO + index_offset, reg); + outb (pSIS->RelIO + index_offset+1, data); } /* VBlank */ static CARD8 vblank_active_CRT1(SISPtr pSIS) { - return (inb(pSIS->RelIO + input_stat) & 0x08); + return (inb(pSIS->RelIO + input_stat) & 0x08); } static CARD8 vblank_active_CRT2(SISPtr pSIS) { - return (getsisreg(pSIS, crt2_index_offset, Index_CRT2_FC_VR) & 0x02); + return (getsisreg(pSIS, crt2_index_offset, Index_CRT2_FC_VR) & 0x02); } /* Scanline */ static CARD32 get_scanline_CRT1(SISPtr pSIS) { - CARD32 line; + CARD32 line; - _siswrite (pSIS, REG_PRIM_CRT_COUNTER, 0x00000001); - line = _sisread (pSIS, REG_PRIM_CRT_COUNTER); + _siswrite (pSIS, REG_PRIM_CRT_COUNTER, 0x00000001); + line = _sisread (pSIS, REG_PRIM_CRT_COUNTER); - return ((line >> 16) & 0x07FF); + return ((line >> 16) & 0x07FF); } static CARD32 get_scanline_CRT2(SISPtr pSIS) { - CARD32 line; + CARD32 line; - line = (CARD32)(getsisreg(pSIS, crt2_index_offset, Index_CRT2_FC_VCount1) & 0x70) * 16 - + getsisreg(pSIS, crt2_index_offset, Index_CRT2_FC_VCount); + line = (CARD32)(getsisreg(pSIS, crt2_index_offset, Index_CRT2_FC_VCount1) & 0x70) * 16 + + getsisreg(pSIS, crt2_index_offset, Index_CRT2_FC_VCount); - return line; + return line; } void SISInitVideo(ScreenPtr pScreen) @@ -212,36 +211,36 @@ void SISInitVideo(ScreenPtr pScreen) XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; XF86VideoAdaptorPtr newAdaptor = NULL; int num_adaptors; - + if (pScrn->bitsPerPixel != 8) { - newAdaptor = SISSetupImageVideo(pScreen); + newAdaptor = SISSetupImageVideo(pScreen); } num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); if(newAdaptor) { - if(!num_adaptors) { - num_adaptors = 1; - adaptors = &newAdaptor; - } else { - newAdaptors = /* need to free this someplace */ - xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); - if(newAdaptors) { - memcpy(newAdaptors, adaptors, num_adaptors * - sizeof(XF86VideoAdaptorPtr)); - newAdaptors[num_adaptors] = newAdaptor; - adaptors = newAdaptors; - num_adaptors++; - } - } + if(!num_adaptors) { + num_adaptors = 1; + adaptors = &newAdaptor; + } else { + newAdaptors = /* need to free this someplace */ + xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + if(newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } } if(num_adaptors) xf86XVScreenInit(pScreen, adaptors, num_adaptors); if(newAdaptors) - xfree(newAdaptors); + xfree(newAdaptors); } @@ -279,94 +278,94 @@ static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = static XF86ImageRec Images[NUM_IMAGES] = { { - PIXEL_FMT_YUY2, + PIXEL_FMT_YUY2, XvYUV, - LSBFirst, - {'Y','U','Y','2', - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, - 16, - XvPacked, - 1, - 0, 0, 0, 0 , - 8, 8, 8, - 1, 2, 2, - 1, 1, 1, - {'Y','U','Y','V', - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - XvTopToBottom + LSBFirst, + {'Y','U','Y','2', + 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, + 16, + XvPacked, + 1, + 0, 0, 0, 0 , + 8, 8, 8, + 1, 2, 2, + 1, 1, 1, + {'Y','U','Y','V', + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + XvTopToBottom }, { - PIXEL_FMT_YV12, + PIXEL_FMT_YV12, XvYUV, - LSBFirst, - {'Y','V','1','2', - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, - 12, - XvPlanar, - 3, - 0, 0, 0, 0 , - 8, 8, 8, - 1, 2, 2, - 1, 2, 2, - {'Y','V','U', - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - XvTopToBottom + LSBFirst, + {'Y','V','1','2', + 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, + 12, + XvPlanar, + 3, + 0, 0, 0, 0 , + 8, 8, 8, + 1, 2, 2, + 1, 2, 2, + {'Y','V','U', + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + XvTopToBottom } }; typedef struct { - int pixelFormat; + int pixelFormat; - CARD16 pitch; + CARD16 pitch; - CARD8 keyOP; - CARD16 HUSF; - CARD16 VUSF; - CARD8 IntBit; - CARD8 wHPre; + CARD8 keyOP; + CARD16 HUSF; + CARD16 VUSF; + CARD8 IntBit; + CARD8 wHPre; - CARD16 srcW; - CARD16 srcH; + CARD16 srcW; + CARD16 srcH; - BoxRec dstBox; + BoxRec dstBox; - CARD32 PSY; - CARD32 PSV; - CARD32 PSU; - CARD8 bobEnable; + CARD32 PSY; + CARD32 PSV; + CARD32 PSU; + CARD8 bobEnable; - CARD8 contrastCtrl; - CARD8 contrastFactor; + CARD8 contrastCtrl; + CARD8 contrastFactor; - CARD8 lineBufSize; + CARD8 lineBufSize; - CARD8 (*VBlankActiveFunc)(SISPtr); - CARD32 (*GetScanLineFunc)(SISPtr pSIS); + CARD8 (*VBlankActiveFunc)(SISPtr); + CARD32 (*GetScanLineFunc)(SISPtr pSIS); } SISOverlayRec, *SISOverlayPtr; typedef struct { - FBAreaPtr fbAreaPtr; - int fbSize; - CARD32 bufAddr[2]; + FBAreaPtr fbAreaPtr; + int fbSize; + CARD32 bufAddr[2]; - unsigned char currentBuf; + unsigned char currentBuf; - short drw_x, drw_y, drw_w, drw_h; - short src_x, src_y, src_w, src_h; - int id; - short srcPitch, height; - - unsigned char brightness; - unsigned char contrast; + short drw_x, drw_y, drw_w, drw_h; + short src_x, src_y, src_w, src_h; + int id; + short srcPitch, height; + + unsigned char brightness; + unsigned char contrast; - RegionRec clip; - CARD32 colorKey; + RegionRec clip; + CARD32 colorKey; - CARD32 videoStatus; - Time offTime; - Time freeTime; + CARD32 videoStatus; + Time offTime; + Time freeTime; - CARD32 displayMode; + CARD32 displayMode; } SISPortPrivRec, *SISPortPrivPtr; #define GET_PORT_PRIVATE(pScrn) \ @@ -378,59 +377,59 @@ SISResetVideo(ScrnInfoPtr pScrn) { SISPtr pSIS = SISPTR(pScrn); - if (getsrreg (pSIS, 0x05) != 0xa1) - { - setsrreg (pSIS, 0x05, 0x86); - if (getsrreg (pSIS, 0x05) != 0xa1) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Standard password not initialize\n"); - } - if (getvideoreg (pSIS, Index_VI_Passwd) != 0xa1) - { - setvideoreg (pSIS, Index_VI_Passwd, 0x86); - if (getvideoreg (pSIS, Index_VI_Passwd) != 0xa1) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Video password not initialize\n"); - } - - /* Initial first set */ - setvideoregmask (pSIS, Index_VI_Control_Misc2, 0x80, 0x81); - setvideoregmask(pSIS, Index_VI_Control_Misc0, 0x00, 0x02); - setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x02, 0x02); - setvideoregmask(pSIS, Index_VI_Scale_Control, 0x60, 0x60); - setvideoregmask(pSIS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x1F); + if (getsrreg (pSIS, 0x05) != 0xa1) + { + setsrreg (pSIS, 0x05, 0x86); + if (getsrreg (pSIS, 0x05) != 0xa1) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Standard password not initialize\n"); + } + if (getvideoreg (pSIS, Index_VI_Passwd) != 0xa1) + { + setvideoreg (pSIS, Index_VI_Passwd, 0x86); + if (getvideoreg (pSIS, Index_VI_Passwd) != 0xa1) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Video password not initialize\n"); + } + + /* Initial first set */ + setvideoregmask (pSIS, Index_VI_Control_Misc2, 0x80, 0x81); + setvideoregmask(pSIS, Index_VI_Control_Misc0, 0x00, 0x02); + setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x02, 0x02); + setvideoregmask(pSIS, Index_VI_Scale_Control, 0x60, 0x60); + setvideoregmask(pSIS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x1F); - setvideoreg(pSIS, Index_VI_Disp_Y_Buf_Preset_Low, 0x00); - setvideoreg(pSIS, Index_VI_Disp_Y_Buf_Preset_Middle, 0x00); - setvideoreg(pSIS, Index_VI_UV_Buf_Preset_Low, 0x00); - setvideoreg(pSIS, Index_VI_UV_Buf_Preset_Middle, 0x00); - setvideoreg(pSIS, Index_VI_Disp_Y_UV_Buf_Preset_High, 0x00); - setvideoreg(pSIS, Index_VI_Play_Threshold_Low, 0x00); - setvideoreg(pSIS, Index_VI_Play_Threshold_High, 0x00); - - /* Initial second set */ - setvideoregmask(pSIS, Index_VI_Control_Misc2, 0x81, 0x81); - setvideoregmask(pSIS, Index_VI_Control_Misc0, 0x00, 0x02); - setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x02, 0x02); - setvideoregmask(pSIS, Index_VI_Scale_Control, 0x60, 0x60); - setvideoregmask(pSIS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x1F); - - setvideoreg(pSIS, Index_VI_Disp_Y_Buf_Preset_Low, 0x00); - setvideoreg(pSIS, Index_VI_Disp_Y_Buf_Preset_Middle, 0x00); - setvideoreg(pSIS, Index_VI_UV_Buf_Preset_Low, 0x00); - setvideoreg(pSIS, Index_VI_UV_Buf_Preset_Middle, 0x00); - setvideoreg(pSIS, Index_VI_Disp_Y_UV_Buf_Preset_High, 0x00); - setvideoreg(pSIS, Index_VI_Play_Threshold_Low, 0x00); - setvideoreg(pSIS, Index_VI_Play_Threshold_High, 0x00); - - /* set default contrast */ - setvideoregmask (pSIS, Index_VI_Control_Misc2, 0x00, 0x01); - setvideoregmask (pSIS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x07); - setvideoreg (pSIS, Index_VI_Brightness, 0x20); - - setvideoregmask (pSIS, Index_VI_Control_Misc2, 0x01, 0x01); - setvideoregmask (pSIS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x07); - setvideoreg (pSIS, Index_VI_Brightness, 0x20); + setvideoreg(pSIS, Index_VI_Disp_Y_Buf_Preset_Low, 0x00); + setvideoreg(pSIS, Index_VI_Disp_Y_Buf_Preset_Middle, 0x00); + setvideoreg(pSIS, Index_VI_UV_Buf_Preset_Low, 0x00); + setvideoreg(pSIS, Index_VI_UV_Buf_Preset_Middle, 0x00); + setvideoreg(pSIS, Index_VI_Disp_Y_UV_Buf_Preset_High, 0x00); + setvideoreg(pSIS, Index_VI_Play_Threshold_Low, 0x00); + setvideoreg(pSIS, Index_VI_Play_Threshold_High, 0x00); + + /* Initial second set */ + setvideoregmask(pSIS, Index_VI_Control_Misc2, 0x81, 0x81); + setvideoregmask(pSIS, Index_VI_Control_Misc0, 0x00, 0x02); + setvideoregmask(pSIS, Index_VI_Control_Misc1, 0x02, 0x02); + setvideoregmask(pSIS, Index_VI_Scale_Control, 0x60, 0x60); + setvideoregmask(pSIS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x1F); + + setvideoreg(pSIS, Index_VI_Disp_Y_Buf_Preset_Low, 0x00); + setvideoreg(pSIS, Index_VI_Disp_Y_Buf_Preset_Middle, 0x00); + setvideoreg(pSIS, Index_VI_UV_Buf_Preset_Low, 0x00); + setvideoreg(pSIS, Index_VI_UV_Buf_Preset_Middle, 0x00); + setvideoreg(pSIS, Index_VI_Disp_Y_UV_Buf_Preset_High, 0x00); + setvideoreg(pSIS, Index_VI_Play_Threshold_Low, 0x00); + setvideoreg(pSIS, Index_VI_Play_Threshold_High, 0x00); + + /* set default contrast */ + setvideoregmask (pSIS, Index_VI_Control_Misc2, 0x00, 0x01); + setvideoregmask (pSIS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x07); + setvideoreg (pSIS, Index_VI_Brightness, 0x20); + + setvideoregmask (pSIS, Index_VI_Control_Misc2, 0x01, 0x01); + setvideoregmask (pSIS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x07); + setvideoreg (pSIS, Index_VI_Brightness, 0x20); } @@ -444,9 +443,9 @@ SISSetupImageVideo(ScreenPtr pScreen) SISPortPrivPtr pPriv; if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + - sizeof(SISPortPrivRec) + - sizeof(DevUnion)))) - return NULL; + sizeof(SISPortPrivRec) + + sizeof(DevUnion)))) + return NULL; adapt->type = XvWindowMask | XvInputMask | XvImageMask; adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; @@ -525,22 +524,22 @@ RegionsEqual(RegionPtr A, RegionPtr B) num = REGION_NUM_RECTS(A); if(num != REGION_NUM_RECTS(B)) - return FALSE; + 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; + 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; + if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + dataA += 2; + dataB += 2; } return TRUE; @@ -558,18 +557,18 @@ SISSetPortAttribute( SISPortPrivPtr pPriv = (SISPortPrivPtr)data; if(attribute == xvBrightness) { - if((value < -128) || (value > 127)) - return BadValue; - pPriv->brightness = value; + if((value < -128) || (value > 127)) + return BadValue; + pPriv->brightness = value; } else if(attribute == xvContrast) { - if((value < 0) || (value > 255)) - return BadValue; - pPriv->contrast = value; + if((value < 0) || (value > 255)) + return BadValue; + pPriv->contrast = value; } else if(attribute == xvColorKey) { - pPriv->colorKey = value; - REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + pPriv->colorKey = value; + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); } else return BadMatch; return Success; @@ -585,13 +584,13 @@ SISGetPortAttribute( SISPortPrivPtr pPriv = (SISPortPrivPtr)data; if(attribute == xvBrightness) { - *value = pPriv->brightness; + *value = pPriv->brightness; } else if(attribute == xvContrast) { - *value = pPriv->contrast; + *value = pPriv->contrast; } else if(attribute == xvColorKey) { - *value = pPriv->colorKey; + *value = pPriv->colorKey; } else return BadMatch; return Success; @@ -625,139 +624,139 @@ set_scale_factor(SISOverlayPtr pOverlay) int srcPitch = pOverlay->pitch; - if (dstW == srcW) { - pOverlay->HUSF = 0x00; - pOverlay->IntBit = 0x05; - } - else if (dstW > srcW) { - dstW += 2; - pOverlay->HUSF = (srcW << 16) / dstW; - pOverlay->IntBit = 0x04; - } - else { - int tmpW = dstW; - - I = 0x00; - pOverlay->IntBit = 0x01; - while (srcW >= tmpW) - { - tmpW <<= 1; - I++; - } - pOverlay->wHPre = (CARD8)(I - 1); - dstW <<= (I - 1); - if ((srcW % dstW)) - pOverlay->HUSF = ((srcW - dstW) << 16) / dstW; - else - pOverlay->HUSF = 0x00; - } - - if (dstH == srcH) { - pOverlay->VUSF = 0x00; - pOverlay->IntBit |= 0x0A; - } - else if (dstH > srcH) { - dstH += 0x02; - pOverlay->VUSF = (srcH << 16) / dstH; - pOverlay->IntBit |= 0x08; - } - else { - CARD32 realI; - - I = realI = srcH / dstH; - pOverlay->IntBit |= 0x02; - - if (I < 2) - { - pOverlay->VUSF = ((srcH - dstH)<<16)/dstH; - } - else - { + if (dstW == srcW) { + pOverlay->HUSF = 0x00; + pOverlay->IntBit = 0x05; + } + else if (dstW > srcW) { + dstW += 2; + pOverlay->HUSF = (srcW << 16) / dstW; + pOverlay->IntBit = 0x04; + } + else { + int tmpW = dstW; + + I = 0x00; + pOverlay->IntBit = 0x01; + while (srcW >= tmpW) + { + tmpW <<= 1; + I++; + } + pOverlay->wHPre = (CARD8)(I - 1); + dstW <<= (I - 1); + if ((srcW % dstW)) + pOverlay->HUSF = ((srcW - dstW) << 16) / dstW; + else + pOverlay->HUSF = 0x00; + } + + if (dstH == srcH) { + pOverlay->VUSF = 0x00; + pOverlay->IntBit |= 0x0A; + } + else if (dstH > srcH) { + dstH += 0x02; + pOverlay->VUSF = (srcH << 16) / dstH; + pOverlay->IntBit |= 0x08; + } + else { + CARD32 realI; + + I = realI = srcH / dstH; + pOverlay->IntBit |= 0x02; + + if (I < 2) + { + pOverlay->VUSF = ((srcH - dstH)<<16)/dstH; + } + else + { #if 0 - if (((pOverlay->bobEnable & 0x08) == 0x00) && - (((srcPitch * I)>>2) > 0xFFF)) - { - pOverlay->bobEnable |= 0x08; - srcPitch >>= 1; - } + if (((pOverlay->bobEnable & 0x08) == 0x00) && + (((srcPitch * I)>>2) > 0xFFF)) + { + pOverlay->bobEnable |= 0x08; + srcPitch >>= 1; + } #endif - if (((srcPitch * I)>>2) > 0xFFF) - { - I = (0xFFF*2/srcPitch); - pOverlay->VUSF = 0xFFFF; - } - else - { - dstH = I * dstH; - if (srcH % dstH) - pOverlay->VUSF = ((srcH - dstH) << 16) / dstH; - else - pOverlay->VUSF = 0x00; - } - /* set video frame buffer offset */ - pOverlay->pitch = (CARD16)(srcPitch*I); - } - } + if (((srcPitch * I)>>2) > 0xFFF) + { + I = (0xFFF*2/srcPitch); + pOverlay->VUSF = 0xFFFF; + } + else + { + dstH = I * dstH; + if (srcH % dstH) + pOverlay->VUSF = ((srcH - dstH) << 16) / dstH; + else + pOverlay->VUSF = 0x00; + } + /* set video frame buffer offset */ + pOverlay->pitch = (CARD16)(srcPitch*I); + } + } } static void set_line_buf_size(SISOverlayPtr pOverlay) { - CARD8 preHIDF; - CARD32 I; - CARD32 line = pOverlay->srcW; - - if (pOverlay->pixelFormat == PIXEL_FMT_YV12) - { - preHIDF = pOverlay->wHPre & 0x07; - switch (preHIDF) - { - case 3 : - if ((line & 0xffffff00) == line) - I = (line >> 8); - else - I = (line >> 8) + 1; - pOverlay->lineBufSize = (CARD8)(I * 32 - 1); - break; - case 4 : - if ((line & 0xfffffe00) == line) - I = (line >> 9); - else - I = (line >> 9) + 1; - pOverlay->lineBufSize = (CARD8)(I * 64 - 1); - break; - case 5 : - if ((line & 0xfffffc00) == line) - I = (line >> 10); - else - I = (line >> 10) + 1; - pOverlay->lineBufSize = (CARD8)(I * 128 - 1); - break; - case 6 : - if ((line & 0xfffff800) == line) - I = (line >> 11); - else - I = (line >> 11) + 1; - pOverlay->lineBufSize = (CARD8)(I * 256 - 1); - break; - default : - if ((line & 0xffffff80) == line) - I = (line >> 7); - else - I = (line >> 7) + 1; - pOverlay->lineBufSize = (CARD8)(I * 16 - 1); - break; - } - } - else - { - if ((line & 0xffffff8) == line) - I = (line >> 3); - else - I = (line >> 3) + 1; - pOverlay->lineBufSize = (CARD8)(I - 1); - } + CARD8 preHIDF; + CARD32 I; + CARD32 line = pOverlay->srcW; + + if (pOverlay->pixelFormat == PIXEL_FMT_YV12) + { + preHIDF = pOverlay->wHPre & 0x07; + switch (preHIDF) + { + case 3 : + if ((line & 0xffffff00) == line) + I = (line >> 8); + else + I = (line >> 8) + 1; + pOverlay->lineBufSize = (CARD8)(I * 32 - 1); + break; + case 4 : + if ((line & 0xfffffe00) == line) + I = (line >> 9); + else + I = (line >> 9) + 1; + pOverlay->lineBufSize = (CARD8)(I * 64 - 1); + break; + case 5 : + if ((line & 0xfffffc00) == line) + I = (line >> 10); + else + I = (line >> 10) + 1; + pOverlay->lineBufSize = (CARD8)(I * 128 - 1); + break; + case 6 : + if ((line & 0xfffff800) == line) + I = (line >> 11); + else + I = (line >> 11) + 1; + pOverlay->lineBufSize = (CARD8)(I * 256 - 1); + break; + default : + if ((line & 0xffffff80) == line) + I = (line >> 7); + else + I = (line >> 7) + 1; + pOverlay->lineBufSize = (CARD8)(I * 16 - 1); + break; + } + } + else + { + if ((line & 0xffffff8) == line) + I = (line >> 3); + else + I = (line >> 3) + 1; + pOverlay->lineBufSize = (CARD8)(I - 1); + } } static void @@ -789,132 +788,132 @@ merge_line_buf(SISPtr pSIS, SISPortPrivPtr pPriv, Bool enable) static void set_format(SISPtr pSIS, SISOverlayPtr pOverlay) { - CARD8 fmt; - - switch (pOverlay->pixelFormat) - { - case PIXEL_FMT_YV12: - fmt = 0x0c; - break; - case PIXEL_FMT_YUY2: - fmt = 0x28; - break; - default: - fmt = 0x00; - break; - } - setvideoregmask(pSIS, Index_VI_Control_Misc0, fmt, 0x7c); + CARD8 fmt; + + switch (pOverlay->pixelFormat) + { + case PIXEL_FMT_YV12: + fmt = 0x0c; + break; + case PIXEL_FMT_YUY2: + fmt = 0x28; + break; + default: + fmt = 0x00; + break; + } + setvideoregmask(pSIS, Index_VI_Control_Misc0, fmt, 0x7c); } static void set_colorkey(SISPtr pSIS, CARD32 colorkey) { - CARD8 r, g, b; + CARD8 r, g, b; - b = (CARD8)(colorkey & 0xFF); - g = (CARD8)((colorkey>>8) & 0xFF); - r = (CARD8)((colorkey>>16) & 0xFF); + b = (CARD8)(colorkey & 0xFF); + g = (CARD8)((colorkey>>8) & 0xFF); + r = (CARD8)((colorkey>>16) & 0xFF); /* Activate the colorkey mode */ - setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Blue_Min ,(CARD8)b); - setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Green_Min ,(CARD8)g); - setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Red_Min ,(CARD8)r); + setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Blue_Min ,(CARD8)b); + setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Green_Min ,(CARD8)g); + setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Red_Min ,(CARD8)r); - setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Blue_Max ,(CARD8)b); - setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Green_Max ,(CARD8)g); - setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Red_Max ,(CARD8)r); + setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Blue_Max ,(CARD8)b); + setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Green_Max ,(CARD8)g); + setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Red_Max ,(CARD8)r); } static void set_brightness(SISPtr pSIS, CARD8 brightness) { - setvideoreg(pSIS, Index_VI_Brightness ,brightness); + setvideoreg(pSIS, Index_VI_Brightness ,brightness); } static void set_overlay(SISPtr pSIS, SISOverlayPtr pOverlay) { - ScrnInfoPtr pScrn = pSIS->pScrn; - - CARD16 pitch=0; - CARD8 h_over=0, v_over=0; - CARD16 bottom, right; - CARD16 screenX = pScrn->currentMode->HDisplay; - CARD16 screenY = pScrn->currentMode->VDisplay; - - bottom = pOverlay->dstBox.y2; - if (bottom > screenY) - bottom = screenY; - - right = pOverlay->dstBox.x2; - if (right > screenX) - right = screenX; - - h_over = (((pOverlay->dstBox.x1>>8) & 0x0f) | ((right>>4) & 0xf0)); - v_over = (((pOverlay->dstBox.y1>>8) & 0x0f) | ((bottom>>4) & 0xf0)); - - pitch = pOverlay->pitch; - - /* set line buffer size */ - setvideoreg(pSIS, Index_VI_Line_Buffer_Size, pOverlay->lineBufSize); - - setvideoregmask (pSIS, Index_VI_Key_Overlay_OP, pOverlay->keyOP, 0x0f); - - while (pOverlay->VBlankActiveFunc(pSIS)); - while (!pOverlay->VBlankActiveFunc(pSIS)); - - setvideoreg (pSIS, Index_VI_Disp_Y_Buf_Pitch_Low, (CARD8)(pitch>>2)); - setvideoregmask (pSIS, Index_VI_Disp_Y_UV_Buf_Pitch_High, (CARD8)(pitch >> 10), 0x0f); - - setvideoregmask (pSIS, Index_VI_Control_Misc1, 0x20, 0x20); - if (pOverlay->pixelFormat == PIXEL_FMT_YV12) - { - CARD32 PSU=0, PSV=0; - - PSU = pOverlay->PSU; - PSV = pOverlay->PSV; - - setvideoreg (pSIS, Index_VI_Disp_UV_Buf_Pitch_Low, (CARD8)(pitch >> 3)); - setvideoregmask (pSIS, Index_VI_Disp_Y_UV_Buf_Pitch_High, (CARD8)(pitch >> 7), 0xf0); - /* set U/V start address */ - setvideoreg (pSIS, Index_VI_U_Buf_Start_Low, (CARD8)PSU); - setvideoreg (pSIS, Index_VI_U_Buf_Start_Middle,(CARD8)(PSU>>8)); - setvideoreg (pSIS, Index_VI_U_Buf_Start_High, (CARD8)(PSU>>16)); - - setvideoreg (pSIS, Index_VI_V_Buf_Start_Low, (CARD8)PSV); - setvideoreg (pSIS, Index_VI_V_Buf_Start_Middle,(CARD8)(PSV>>8)); - setvideoreg (pSIS, Index_VI_V_Buf_Start_High, (CARD8)(PSV>>16)); - } - /* set scale factor */ - setvideoreg (pSIS, Index_VI_Hor_Post_Up_Scale_Low, (CARD8)(pOverlay->HUSF)); - setvideoreg (pSIS, Index_VI_Hor_Post_Up_Scale_High,(CARD8)((pOverlay->HUSF)>>8)); - setvideoreg (pSIS, Index_VI_Ver_Up_Scale_Low, (CARD8)(pOverlay->VUSF)); - setvideoreg (pSIS, Index_VI_Ver_Up_Scale_High, (CARD8)((pOverlay->VUSF)>>8)); - - setvideoregmask (pSIS, Index_VI_Scale_Control, (pOverlay->IntBit << 3)|(pOverlay->wHPre), 0x7f); - - /* set destination position */ - setvideoreg(pSIS, Index_VI_Win_Hor_Disp_Start_Low, (CARD8)pOverlay->dstBox.x1); - setvideoreg(pSIS, Index_VI_Win_Hor_Disp_End_Low, (CARD8)right); - setvideoreg(pSIS, Index_VI_Win_Hor_Over, (CARD8)h_over); - - setvideoreg(pSIS, Index_VI_Win_Ver_Disp_Start_Low, (CARD8)pOverlay->dstBox.y1); - setvideoreg(pSIS, Index_VI_Win_Ver_Disp_End_Low, (CARD8)bottom); - setvideoreg(pSIS, Index_VI_Win_Ver_Over, (CARD8)v_over); - - /* set display start address */ - setvideoreg (pSIS, Index_VI_Disp_Y_Buf_Start_Low, (CARD8)(pOverlay->PSY)); - setvideoreg (pSIS, Index_VI_Disp_Y_Buf_Start_Middle, (CARD8)((pOverlay->PSY)>>8)); - setvideoreg (pSIS, Index_VI_Disp_Y_Buf_Start_High, (CARD8)((pOverlay->PSY)>>16)); - setvideoregmask(pSIS, Index_VI_Control_Misc1, pOverlay->bobEnable, 0x1a); - setvideoregmask (pSIS, Index_VI_Control_Misc1, 0x00, 0x20); - - /* set contrast factor */ + ScrnInfoPtr pScrn = pSIS->pScrn; + + CARD16 pitch=0; + CARD8 h_over=0, v_over=0; + CARD16 bottom, right; + CARD16 screenX = pScrn->currentMode->HDisplay; + CARD16 screenY = pScrn->currentMode->VDisplay; + + bottom = pOverlay->dstBox.y2; + if (bottom > screenY) + bottom = screenY; + + right = pOverlay->dstBox.x2; + if (right > screenX) + right = screenX; + + h_over = (((pOverlay->dstBox.x1>>8) & 0x0f) | ((right>>4) & 0xf0)); + v_over = (((pOverlay->dstBox.y1>>8) & 0x0f) | ((bottom>>4) & 0xf0)); + + pitch = pOverlay->pitch; + + /* set line buffer size */ + setvideoreg(pSIS, Index_VI_Line_Buffer_Size, pOverlay->lineBufSize); + + setvideoregmask (pSIS, Index_VI_Key_Overlay_OP, pOverlay->keyOP, 0x0f); + + while (pOverlay->VBlankActiveFunc(pSIS)); + while (!pOverlay->VBlankActiveFunc(pSIS)); + + setvideoreg (pSIS, Index_VI_Disp_Y_Buf_Pitch_Low, (CARD8)(pitch>>2)); + setvideoregmask (pSIS, Index_VI_Disp_Y_UV_Buf_Pitch_High, (CARD8)(pitch >> 10), 0x0f); + + setvideoregmask (pSIS, Index_VI_Control_Misc1, 0x20, 0x20); + if (pOverlay->pixelFormat == PIXEL_FMT_YV12) + { + CARD32 PSU=0, PSV=0; + + PSU = pOverlay->PSU; + PSV = pOverlay->PSV; + + setvideoreg (pSIS, Index_VI_Disp_UV_Buf_Pitch_Low, (CARD8)(pitch >> 3)); + setvideoregmask (pSIS, Index_VI_Disp_Y_UV_Buf_Pitch_High, (CARD8)(pitch >> 7), 0xf0); + /* set U/V start address */ + setvideoreg (pSIS, Index_VI_U_Buf_Start_Low, (CARD8)PSU); + setvideoreg (pSIS, Index_VI_U_Buf_Start_Middle,(CARD8)(PSU>>8)); + setvideoreg (pSIS, Index_VI_U_Buf_Start_High, (CARD8)(PSU>>16)); + + setvideoreg (pSIS, Index_VI_V_Buf_Start_Low, (CARD8)PSV); + setvideoreg (pSIS, Index_VI_V_Buf_Start_Middle,(CARD8)(PSV>>8)); + setvideoreg (pSIS, Index_VI_V_Buf_Start_High, (CARD8)(PSV>>16)); + } + /* set scale factor */ + setvideoreg (pSIS, Index_VI_Hor_Post_Up_Scale_Low, (CARD8)(pOverlay->HUSF)); + setvideoreg (pSIS, Index_VI_Hor_Post_Up_Scale_High,(CARD8)((pOverlay->HUSF)>>8)); + setvideoreg (pSIS, Index_VI_Ver_Up_Scale_Low, (CARD8)(pOverlay->VUSF)); + setvideoreg (pSIS, Index_VI_Ver_Up_Scale_High, (CARD8)((pOverlay->VUSF)>>8)); + + setvideoregmask (pSIS, Index_VI_Scale_Control, (pOverlay->IntBit << 3)|(pOverlay->wHPre), 0x7f); + + /* set destination position */ + setvideoreg(pSIS, Index_VI_Win_Hor_Disp_Start_Low, (CARD8)pOverlay->dstBox.x1); + setvideoreg(pSIS, Index_VI_Win_Hor_Disp_End_Low, (CARD8)right); + setvideoreg(pSIS, Index_VI_Win_Hor_Over, (CARD8)h_over); + + setvideoreg(pSIS, Index_VI_Win_Ver_Disp_Start_Low, (CARD8)pOverlay->dstBox.y1); + setvideoreg(pSIS, Index_VI_Win_Ver_Disp_End_Low, (CARD8)bottom); + setvideoreg(pSIS, Index_VI_Win_Ver_Over, (CARD8)v_over); + + /* set display start address */ + setvideoreg (pSIS, Index_VI_Disp_Y_Buf_Start_Low, (CARD8)(pOverlay->PSY)); + setvideoreg (pSIS, Index_VI_Disp_Y_Buf_Start_Middle, (CARD8)((pOverlay->PSY)>>8)); + setvideoreg (pSIS, Index_VI_Disp_Y_Buf_Start_High, (CARD8)((pOverlay->PSY)>>16)); + setvideoregmask(pSIS, Index_VI_Control_Misc1, pOverlay->bobEnable, 0x1a); + setvideoregmask (pSIS, Index_VI_Control_Misc1, 0x00, 0x20); + + /* set contrast factor */ /* - setvideoregmask(pSIS, Index_VI_Contrast_Enh_Ctrl, pOverlay->contrastCtrl<<6, 0xc0); - setvideoreg (pSIS, Index_VI_Contrast_Factor, pOverlay->contrastFactor); + setvideoregmask(pSIS, Index_VI_Contrast_Enh_Ctrl, pOverlay->contrastCtrl<<6, 0xc0); + setvideoreg (pSIS, Index_VI_Contrast_Factor, pOverlay->contrastFactor); */ } @@ -1074,10 +1073,10 @@ SISStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) pPriv->videoStatus = 0; } else { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { - pPriv->videoStatus |= OFF_TIMER; - pPriv->offTime = currentTime.milliseconds + OFF_DELAY; - /* FIXME */ -/* SISDisplayVideo(pScrn, pPriv); */ + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + /* FIXME */ +/* SISDisplayVideo(pScrn, pPriv); */ } } } @@ -1135,14 +1134,14 @@ SISPutImage( /* TODO: use xf86AllocateOffscreenLinear is better */ if(pPriv->fbAreaPtr) { /* TODO: resize */ - xf86FreeOffscreenArea(pPriv->fbAreaPtr); + xf86FreeOffscreenArea(pPriv->fbAreaPtr); } depth = (pScrn->bitsPerPixel + 7 ) / 8; pitch = pScrn->displayWidth * depth; lines = ((totalSize * 2) / pitch) + 1; pPriv->fbAreaPtr = xf86AllocateOffscreenArea(pScrn->pScreen, pScrn->displayWidth, - lines, 0, NULL, NULL, NULL); + lines, 0, NULL, NULL, NULL); if(!pPriv->fbAreaPtr) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -1162,17 +1161,17 @@ SISPutImage( /* update cliplist */ if(!RegionsEqual(&pPriv->clip, clipBoxes)) { - REGION_COPY(pScreen, &pPriv->clip, clipBoxes); - /* draw these */ - XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + /* draw these */ + XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); } if (pPriv->currentBuf == 0) - pPriv->currentBuf = 1; + pPriv->currentBuf = 1; else - pPriv->currentBuf = 0; + pPriv->currentBuf = 0; pPriv->videoStatus = CLIENT_VIDEO_ON; @@ -1201,28 +1200,28 @@ SISQueryImageAttributes( *w = (*w + 7) & ~7; *h = (*h + 1) & ~1; pitchY = *w; - pitchUV = *w >> 1; - if(pitches) { - pitches[0] = pitchY; - pitches[1] = pitches[2] = pitchUV; + pitchUV = *w >> 1; + if(pitches) { + pitches[0] = pitchY; + pitches[1] = pitches[2] = pitchUV; } - sizeY = pitchY * (*h); - sizeUV = pitchUV * ((*h) >> 1); - if(offsets) { + sizeY = pitchY * (*h); + sizeUV = pitchUV * ((*h) >> 1); + if(offsets) { offsets[0] = 0; offsets[1] = sizeY; offsets[2] = sizeY + sizeUV; } size = sizeY + (sizeUV << 1); - break; + break; case PIXEL_FMT_YUY2: default: *w = (*w + 1) & ~1; pitchY = *w << 1; - if(pitches) pitches[0] = pitchY; - if(offsets) offsets[0] = 0; - size = pitchY * (*h); - break; + if(pitches) pitches[0] = pitchY; + if(offsets) offsets[0] = 0; + size = pitchY * (*h); + break; } return size; @@ -1247,24 +1246,24 @@ SISBlockHandler ( pScreen->BlockHandler = SISBlockHandler; if(pPriv->videoStatus & TIMER_MASK) { - UpdateCurrentTime(); - if(pPriv->videoStatus & OFF_TIMER) { - if(pPriv->offTime < currentTime.milliseconds) { - /* Turn off the overlay */ - close_overlay(pSIS, pPriv); - - pPriv->videoStatus = FREE_TIMER; - pPriv->freeTime = currentTime.milliseconds + FREE_DELAY; - } - } else { /* FREE_TIMER */ - if(pPriv->freeTime < currentTime.milliseconds) { + UpdateCurrentTime(); + if(pPriv->videoStatus & OFF_TIMER) { + if(pPriv->offTime < currentTime.milliseconds) { + /* Turn off the overlay */ + close_overlay(pSIS, pPriv); + + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + } + } else { /* FREE_TIMER */ + if(pPriv->freeTime < currentTime.milliseconds) { if(pPriv->fbAreaPtr) { xf86FreeOffscreenArea(pPriv->fbAreaPtr); pPriv->fbAreaPtr = NULL; pPriv->fbSize = 0; } - pPriv->videoStatus = 0; - } + pPriv->videoStatus = 0; + } } } } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c index a5d97167a..8cceed85a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c,v 1.6 2001/03/21 17:02:25 dawes Exp $ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c,v 1.8 2001/04/18 14:52:42 dawes Exp $ * Acceleration for the Creator and Creator3D framebuffer - DRI/DRM support. * * Copyright (C) 2000 David S. Miller (davem@redhat.com) @@ -80,19 +80,19 @@ FFBDRIInitVisualConfigs(ScreenPtr pScreen) FFBConfigPrivPtr *pFfbConfigPtrs; pConfigs = (__GLXvisualConfig *) - xnfcalloc(sizeof(__GLXvisualConfig), 1); + xcalloc(sizeof(__GLXvisualConfig), 1); if (!pConfigs) return FALSE; pFfbConfigs = (FFBConfigPrivPtr) - xnfcalloc(sizeof(FFBConfigPrivRec), 1); + xcalloc(sizeof(FFBConfigPrivRec), 1); if (!pFfbConfigs) { xfree(pConfigs); return FALSE; } pFfbConfigPtrs = (FFBConfigPrivPtr *) - xnfcalloc(sizeof(FFBConfigPrivPtr), 1); + xcalloc(sizeof(FFBConfigPrivPtr), 1); if (!pFfbConfigPtrs) { xfree(pConfigs); xfree(pFfbConfigs); @@ -214,19 +214,19 @@ FFBDRIScreenInit(ScreenPtr pScreen) "FFBDRIScreenInit failed (libdri.a too old)\n"); return FALSE; } - + /* Check the DRI version */ { int major, minor, patch; DRIQueryVersion(&major, &minor, &patch); - if (major != 3 || minor != 1 || patch < 0) { + if (major != 4 || minor < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] SISDRIScreenInit failed (DRI version = %d.%d.%d, " - "expected 3.1.x). Disabling DRI.\n", + "[drm] FFBDRIScreenInit failed (DRI version = %d.%d.%d, " + "expected 4.0.x). Disabling DRI.\n", major, minor, patch); return FALSE; + } } - } pDRIInfo = DRICreateInfoRec(); if (pDRIInfo == NULL) @@ -254,7 +254,7 @@ FFBDRIScreenInit(ScreenPtr pScreen) pDRIInfo->maxDrawableTableEntry = 15; pDRIInfo->SAREASize = (SAREA_MAX + (0x2000 - 1)) & ~(0x2000 - 1); - pFfbDRI = (FFBDRIPtr) xnfcalloc(sizeof(FFBDRIRec), 1); + pFfbDRI = (FFBDRIPtr) xcalloc(sizeof(FFBDRIRec), 1); if (pFfbDRI == NULL) { DRIDestroyInfoRec(pFfb->pDRIInfo); return FALSE; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h index 2c048a2d2..098318ce0 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.21 2001/04/05 21:29:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.22 2001/04/19 19:54:50 dawes Exp $ */ #ifndef _TDFX_H_ #define _TDFX_H_ @@ -239,10 +239,6 @@ typedef struct { #define TDFX2XCUTOFF 135000 -#ifndef PCI_CHIP_VOODOO5 -#define PCI_CHIP_VOODOO5 9 -#endif - extern Bool TDFXAccelInit(ScreenPtr pScreen); extern Bool TDFXCursorInit(ScreenPtr pScreen); extern void TDFXSync(ScrnInfoPtr pScrn); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c index 82309f52d..320e86a31 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.19 2001/03/21 17:02:26 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.21 2001/04/19 19:54:50 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -50,16 +50,16 @@ TDFXInitVisualConfigs(ScreenPtr pScreen) case 16: numConfigs = 16; - if (!(pConfigs = (__GLXvisualConfig*)xnfcalloc(sizeof(__GLXvisualConfig), + if (!(pConfigs = (__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig), numConfigs))) { return FALSE; } - if (!(pTDFXConfigs = (TDFXConfigPrivPtr)xnfcalloc(sizeof(TDFXConfigPrivRec), + if (!(pTDFXConfigs = (TDFXConfigPrivPtr)xcalloc(sizeof(TDFXConfigPrivRec), numConfigs))) { xfree(pConfigs); return FALSE; } - if (!(pTDFXConfigPtrs = (TDFXConfigPrivPtr*)xnfcalloc(sizeof(TDFXConfigPrivPtr), + if (!(pTDFXConfigPtrs = (TDFXConfigPrivPtr*)xcalloc(sizeof(TDFXConfigPrivPtr), numConfigs))) { xfree(pConfigs); xfree(pTDFXConfigs); @@ -141,17 +141,17 @@ TDFXInitVisualConfigs(ScreenPtr pScreen) case 32: numConfigs = 8; - pConfigs = (__GLXvisualConfig*) xnfcalloc(sizeof(__GLXvisualConfig), numConfigs); + pConfigs = (__GLXvisualConfig*) xcalloc(sizeof(__GLXvisualConfig), numConfigs); if (!pConfigs) return FALSE; - pTDFXConfigs = (TDFXConfigPrivPtr) xnfcalloc(sizeof(TDFXConfigPrivRec), numConfigs); + pTDFXConfigs = (TDFXConfigPrivPtr) xcalloc(sizeof(TDFXConfigPrivRec), numConfigs); if (!pTDFXConfigs) { xfree(pConfigs); return FALSE; } - pTDFXConfigPtrs = (TDFXConfigPrivPtr *) xnfcalloc(sizeof(TDFXConfigPrivPtr), numConfigs); + pTDFXConfigPtrs = (TDFXConfigPrivPtr *) xcalloc(sizeof(TDFXConfigPrivPtr), numConfigs); if (!pTDFXConfigPtrs) { xfree(pConfigs); xfree(pTDFXConfigs); @@ -265,26 +265,33 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) TDFXPtr pTDFX = TDFXPTR(pScrn); DRIInfoPtr pDRIInfo; TDFXDRIPtr pTDFXDRI; + Bool bppOk = FALSE; switch (pScrn->bitsPerPixel) { - case 8: - xf86DrvMsg(pScreen->myNum, X_ERROR, - "DRI not supported in 8 bpp mode, disabling DRI.\n"); - return FALSE; case 16: + bppOk = TRUE; break; - case 24: + case 32: + if (pTDFX->ChipType > PCI_CHIP_VOODOO3) { + bppOk = TRUE; + } + break; + } + if (!bppOk) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "DRI not supported in 24 bpp mode, disabling DRI.\n"); + "DRI not supported in %d bpp mode, disabling DRI.\n", + (pScrn->bitsPerPixel)); + if (pTDFX->ChipType <= PCI_CHIP_VOODOO3) { + xf86DrvMsg(pScreen->myNum, X_INFO, + "To use DRI, invoke the server using 16 bpp " + "(-depth 15 or -depth 16).\n"); + } else { + xf86DrvMsg(pScreen->myNum, X_INFO, + "To use DRI, invoke the server using 16 bpp " + "(-depth 15 or -depth 16)\n" + "\tor 32 bpp (-depth 24 -fbbpp 32).\n"); + } return FALSE; - case 32: - if (pTDFX->ChipType<=PCI_CHIP_VOODOO3) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "DRI requires Voodoo4/5 in 32 bpp mode, disabling DRI.\n"); - xf86DrvMsg(pScreen->myNum, X_INFO, - "To use DRI, invoke the server using 16 bpp (depth 16).\n"); - return FALSE; - } } /* Check that the GLX, DRI, and DRM modules have been loaded by testing @@ -362,7 +369,7 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) pDRIInfo->SAREASize = SAREA_MAX; #endif - if (!(pTDFXDRI = (TDFXDRIPtr)xnfcalloc(sizeof(TDFXDRIRec),1))) { + if (!(pTDFXDRI = (TDFXDRIPtr)xcalloc(sizeof(TDFXDRIRec),1))) { xf86DrvMsg(pScreen->myNum, X_ERROR, "DRI memory allocation failed, disabling DRI.\n"); DRIDestroyInfoRec(pTDFX->pDRIInfo); pTDFX->pDRIInfo=0; 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 f983ad097..d6207994b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c @@ -25,7 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.67 2001/04/05 21:29:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.71 2001/04/23 16:52:22 dawes Exp $ */ /* * Authors: @@ -136,9 +136,6 @@ static void TDFXBlockHandler(int, pointer, pointer, pointer); static void TDFXDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagermentMode, int flags); -#define PCI_SUBDEVICE_ID_VOODOO3_2000 0x0036 -#define PCI_SUBDEVICE_ID_VOODOO3_3000 0x003a - DriverRec TDFX = { TDFX_VERSION, TDFX_DRIVER_NAME, @@ -172,7 +169,8 @@ typedef enum { OPTION_USE_PIO, OPTION_SHOWCACHE, OPTION_VIDEO_KEY, - OPTION_NO_SLI + OPTION_NO_SLI, + OPTION_DRI } TDFXOpts; static OptionInfoRec TDFXOptions[] = { @@ -182,6 +180,7 @@ static OptionInfoRec TDFXOptions[] = { { OPTION_SHOWCACHE, "ShowCache", OPTV_BOOLEAN, {0}, FALSE}, { OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE}, { OPTION_NO_SLI, "NoSLI", OPTV_BOOLEAN, {0}, FALSE}, + { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE}, { -1, NULL, OPTV_NONE, {0}, FALSE} }; @@ -900,10 +899,10 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags) break; case PCI_CHIP_VOODOO3: switch(match->subsysCard) { - case PCI_SUBDEVICE_ID_VOODOO3_2000: + case PCI_CARD_VOODOO3_2000: pTDFX->MaxClock = 300000; break; - case PCI_SUBDEVICE_ID_VOODOO3_3000: + case PCI_CARD_VOODOO3_3000: pTDFX->MaxClock = 350000; break; default: @@ -1813,6 +1812,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { TDFXPtr pTDFX; VisualPtr visual; BoxRec MemBox; + MessageType driFrom = X_DEFAULT; TDFXTRACE("TDFXScreenInit start\n"); pScrn = xf86Screens[pScreen->myNum]; @@ -1832,6 +1832,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { pTDFX->pixmapCacheLinesMin = ((720*480*2) + pTDFX->stride - 1)/pTDFX->stride; allocateMemory(pScrn); + #if 0 if (pTDFX->numChips>1) { if (xf86ReturnOptValBool(TDFXOptions, OPTION_NO_SLI, FALSE)) { @@ -1877,6 +1878,8 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { TDFXSave(pScrn); if (!TDFXModeInit(pScrn, pScrn->currentMode)) return FALSE; + TDFXSetLFBConfig(pTDFX); + miClearVisualTypes(); if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), @@ -1892,10 +1895,14 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { * is called. fbScreenInit will eventually call into the drivers * InitGLXVisuals call back. */ - if (!pTDFX->NoAccel) { - if ((pTDFX->backOffset != -1) && (pTDFX->depthOffset != -1)) { + if (!xf86ReturnOptValBool(TDFXOptions, OPTION_DRI, TRUE) || pTDFX->NoAccel) { + pTDFX->directRenderingEnabled = FALSE; + driFrom = X_CONFIG; + } else if ((pTDFX->backOffset == -1) || (pTDFX->depthOffset == -1)) { + pTDFX->directRenderingEnabled = FALSE; + driFrom = X_PROBED; + } else { pTDFX->directRenderingEnabled = TDFXDRIScreenInit(pScreen); - } } #endif @@ -1961,11 +1968,11 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { if (!miCreateDefColormap(pScreen)) return FALSE; if (pScrn->bitsPerPixel==16) { - if (!xf86HandleColormaps(pScreen, 256, 8, (LoadPaletteFuncPtr)TDFXLoadPalette16, 0, + if (!xf86HandleColormaps(pScreen, 256, 8, TDFXLoadPalette16, 0, CMAP_PALETTED_TRUECOLOR|CMAP_RELOAD_ON_MODE_SWITCH)) return FALSE; } else { - if (!xf86HandleColormaps(pScreen, 256, 8, (LoadPaletteFuncPtr)TDFXLoadPalette24, 0, + if (!xf86HandleColormaps(pScreen, 256, 8, TDFXLoadPalette24, 0, CMAP_PALETTED_TRUECOLOR|CMAP_RELOAD_ON_MODE_SWITCH)) return FALSE; } @@ -1975,18 +1982,16 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { xf86DPMSInit(pScreen, TDFXDisplayPowerManagementSet, 0); #ifdef XF86DRI - if (!pTDFX->NoAccel) { - if (pTDFX->directRenderingEnabled) { + if (pTDFX->directRenderingEnabled) { /* Now that mi, fb, drm and others have done their thing, * complete the DRI setup. */ pTDFX->directRenderingEnabled = TDFXDRIFinishScreenInit(pScreen); - } } if (pTDFX->directRenderingEnabled) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering enabled\n"); + xf86DrvMsg(pScrn->scrnIndex, driFrom, "Direct rendering enabled\n"); } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering disabled\n"); + xf86DrvMsg(pScrn->scrnIndex, driFrom, "Direct rendering disabled\n"); } #endif @@ -2054,7 +2059,6 @@ TDFXEnterVT(int scrnIndex, int flags) { #ifdef XF86DRI pTDFX = TDFXPTR(pScrn); if (pTDFX->directRenderingEnabled) { - pScreen = screenInfo.screens[scrnIndex]; DRIUnlock(pScreen); } #endif @@ -2082,7 +2086,6 @@ TDFXLeaveVT(int scrnIndex, int flags) { #ifdef XF86DRI if (pTDFX->directRenderingEnabled) { DRILock(pScreen, 0); - TDFXSwapContextFifo(pScreen); } #endif } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c index ca7631213..8fead5426 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c @@ -28,7 +28,7 @@ * Massimiliano Ghilardi, max@Linuz.sns.it, some fixes to the * clockchip programming code. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c,v 1.129 2001/04/04 12:46:35 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c,v 1.133 2001/04/26 15:07:44 alanh Exp $ */ #include "xf1bpp.h" #include "xf4bpp.h" @@ -97,6 +97,12 @@ static void TRIDENTDisableMMIO(ScrnInfoPtr pScrn); static void PC98TRIDENTInit(ScrnInfoPtr pScrn); static void PC98TRIDENTEnable(ScrnInfoPtr pScrn); static void PC98TRIDENTDisable(ScrnInfoPtr pScrn); +static void PC98TRIDENT96xxInit(ScrnInfoPtr pScrn); +static void PC98TRIDENT96xxEnable(ScrnInfoPtr pScrn); +static void PC98TRIDENT96xxDisable(ScrnInfoPtr pScrn); +static void PC98TRIDENT9385Init(ScrnInfoPtr pScrn); +static void PC98TRIDENT9385Enable(ScrnInfoPtr pScrn); +static void PC98TRIDENT9385Disable(ScrnInfoPtr pScrn); /* * This is intentionally screen-independent. It indicates the binding @@ -1118,9 +1124,11 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; - if (xf86LoadSubModule(pScrn, "int10")) { - xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Initializing int10\n"); - pTrident->Int10 = xf86InitInt10(pTrident->pEnt->index); + if (!xf86IsPc98()) { + if (xf86LoadSubModule(pScrn, "int10")) { + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Initializing int10\n"); + pTrident->Int10 = xf86InitInt10(pTrident->pEnt->index); + } } xf86SetOperatingState(RES_SHARED_VGA, pTrident->pEnt->index, ResUnusedOpr); @@ -1372,12 +1380,6 @@ TRIDENTPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; TRIDENTEnableMMIO(pScrn); - /* - * PC-9821 PCI Trident Card Magic Setup!! - */ - if (IsPciCard && xf86IsPc98()) { - PC98TRIDENTInit(pScrn); - } } OUTB(0x3C4, RevisionID); revision = INB(0x3C5); @@ -2410,6 +2412,14 @@ TRIDENTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Save the current state */ TRIDENTSave(pScrn); + /* + * Some Trident chip on PC-9821 needs setup, + * because VGA chip is not initialized by VGA BIOS. + */ + if (IsPciCard && xf86IsPc98()) { + PC98TRIDENTInit(pScrn); + } + /* Initialise the first mode */ if (!TRIDENTModeInit(pScrn, pScrn->currentMode)) return FALSE; @@ -2911,11 +2921,91 @@ TRIDENTDisableMMIO(ScrnInfoPtr pScrn) outb(0x3C4, NewMode1); outb(0x3C5, temp); } -/* Initialize VGA Block on Trident(PC-98x1 Only) */ +/* Initialize VGA Block for Trident Chip on PC-98x1 */ static void PC98TRIDENTInit(ScrnInfoPtr pScrn) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + switch (pTrident->Chipset) { + case TGUI9660: + case TGUI9680: + case PROVIDIA9682: + PC98TRIDENT96xxInit(pScrn); + break; + case CYBER9320: + case CYBER9385: + PC98TRIDENT9385Init(pScrn); + break; + default: /* Run 96xx code as default */ + PC98TRIDENT96xxInit(pScrn); + break; + } +} + +static void +PC98TRIDENTEnable(ScrnInfoPtr pScrn) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + switch (pTrident->Chipset) { + case TGUI9660: + case TGUI9680: + case PROVIDIA9682: + PC98TRIDENT96xxEnable(pScrn); + break; + case CYBER9320: + case CYBER9385: + PC98TRIDENT9385Enable(pScrn); + break; + default: /* Run 96xx code as default */ + PC98TRIDENT96xxEnable(pScrn); + break; + } +} + +static void +PC98TRIDENTDisable(ScrnInfoPtr pScrn) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + switch (pTrident->Chipset) { + case TGUI9660: + case TGUI9680: + case PROVIDIA9682: + PC98TRIDENT96xxDisable(pScrn); + break; + case CYBER9320: + case CYBER9385: + PC98TRIDENT9385Disable(pScrn); + break; + default: /* Run 96xx code as default */ + PC98TRIDENT96xxDisable(pScrn); + break; + } +} + +/* Initialize VGA Block for Cyber9385 on PC-98x1 */ +static void +PC98TRIDENT9385Init(ScrnInfoPtr pScrn) +{ +/* Nothing to initialize */ +} + +static void +PC98TRIDENT9385Enable(ScrnInfoPtr pScrn) +{ + outb(0xFAC, 0x02); +} + +static void +PC98TRIDENT9385Disable(ScrnInfoPtr pScrn) +{ + outb(0xFAC, 0x00); +} + +/* Initialize VGA Block for Trident96xx on PC-98x1 */ +static void +PC98TRIDENT96xxInit(ScrnInfoPtr pScrn) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); CARD8 temp = 0; @@ -2991,7 +3081,7 @@ PC98TRIDENTInit(ScrnInfoPtr pScrn) } static void -PC98TRIDENTEnable(ScrnInfoPtr pScrn) +PC98TRIDENT96xxEnable(ScrnInfoPtr pScrn) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); CARD8 temp = 0; @@ -3030,7 +3120,8 @@ PC98TRIDENTEnable(ScrnInfoPtr pScrn) } static void -PC98TRIDENTDisable(ScrnInfoPtr pScrn){ +PC98TRIDENT96xxDisable(ScrnInfoPtr pScrn) +{ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); CARD8 temp = 0; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c b/xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c index 919df18e5..5fdfd4b8d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c @@ -2,7 +2,7 @@ * video4linux Xv Driver * based on Michael Schimek's permedia 2 driver. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c,v 1.22 2001/04/05 20:13:47 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c,v 1.24 2001/04/26 21:27:53 dawes Exp $ */ #include "videodev.h" #include "xf86.h" @@ -838,15 +838,15 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors) DevUnion *Private; XF86VideoAdaptorPtr *VAR = NULL; char dev[18]; - int fd,i,j; + int fd,i,j,d; DEBUG(xf86Msg(X_INFO, "v4l: init start\n")); - for (i = 0; i < MAX_V4L_DEVICES; i++) { - sprintf(dev, "/dev/video%d", i); + for (i = 0, d = 0; d < MAX_V4L_DEVICES; d++) { + sprintf(dev, "/dev/video%d", d); fd = open(dev, O_RDWR, 0); if (fd == -1) { - sprintf(dev, "/dev/v4l/video%d", i); + sprintf(dev, "/dev/v4l/video%d", d); fd = open(dev, O_RDWR, 0); if (fd == -1) break; @@ -864,7 +864,8 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors) 0 == (pPPriv->cap.type & VID_TYPE_OVERLAY)) { DEBUG(xf86Msg(X_INFO, "v4l: %s: no overlay support\n",dev)); xfree(pPPriv); - break; + close(fd); + continue; } strncpy(V4L_NAME, dev, 16); V4LBuildEncodings(pPPriv,fd,pPPriv->cap.channels); @@ -966,6 +967,7 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors) if (fd != -1) close(fd); + i++; } xvEncoding = MAKE_ATOM(XV_ENCODING); @@ -978,7 +980,7 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors) xvMute = MAKE_ATOM(XV_MUTE); xvVolume = MAKE_ATOM(XV_VOLUME); - DEBUG(xf86Msg(X_INFO, "v4l: init done, %d found\n",i)); + DEBUG(xf86Msg(X_INFO, "v4l: init done, %d device(s) found\n",i)); *adaptors = VAR; return i; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h index 0452b5d39..01f6d5f2b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h,v 1.3 2001/04/25 16:44:58 tsi Exp $ */ /* ********************************************************** * Copyright (C) 1998-2001 VMware, Inc. * All Rights Reserved diff --git a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h index a884ce77b..23110fc9b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h,v 1.4 2001/04/25 16:44:58 tsi Exp $ */ /* ********************************************************** * Copyright (C) 1998-2001 VMware, Inc. * All Rights Reserved @@ -23,7 +23,7 @@ #include "includeCheck.h" /* STRICT ANSI means the Xserver build and X defines Bool differently. */ -#ifndef __STRICT_ANSI__ +#if 0 typedef char Bool; #endif @@ -49,7 +49,7 @@ typedef signed __int64 int64; #pragma warning (disable :4146) // unary minus operator applied to unsigned type, result still unsigned #pragma warning (disable :4142) // benign redefinition of type -#elif __GNUC__ +#elif defined(__GNUC__) /* The Xserver source compiles with -ansi -pendantic */ #ifndef __STRICT_ANSI__ typedef unsigned long long uint64; @@ -75,7 +75,7 @@ typedef char int8; #ifdef _MSC_VER #define FMT64 "I64" -#elif __GNUC__ +#elif defined(__GNUC__) #define FMT64 "L" #else #error - Need compiler define for FMT64 @@ -136,7 +136,7 @@ typedef uint32 MPN; */ #ifdef _MSC_VER #define NORETURN_DECL(_fndecl) __declspec(noreturn) _fndecl -#elif __GNUC__ >= 2 && __GNUC_MINOR__ >= 5 +#elif defined(__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 5 #define NORETURN_DECL(_fndecl) _fndecl __attribute__((__noreturn__)) #else #define NORETURN_DECL(_fndecl) _fndecl diff --git a/xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh b/xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh index a88bf7444..cce2b17a2 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.19 2000/12/21 18:40:09 dawes Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh,v 1.20 2001/04/19 16:07:11 dawes Exp $ # # Copyright © 2000 by Precision Insight, Inc. # Copyright © 2000 by VA Linux Systems, Inc. @@ -79,7 +79,7 @@ OPTDIST=" \ Xps.tgz \ " -ETCLINKS=" \ +ETCDLINKS=" \ app-defaults \ fs \ lbxproxy \ @@ -92,6 +92,11 @@ ETCLINKS=" \ xserver \ " +ETCFLINKS=" \ + XftConfig \ + " + + XKBDIR="/etc/X11/xkb" FONTDIRS=" \ @@ -810,22 +815,28 @@ if [ ! -d $RUNDIR/lib/X11/xkb ]; then fi # Check for config file directories that may need to be moved. -EtcToMove= +EtcDirToMove= +EtcFileToMove= if [ X"$NoSymLinks" != XYES ]; then - for i in $ETCLINKS; do + for i in $ETCDLINKS; do if [ -d $RUNDIR/lib/X11/$i -a ! $L $RUNDIR/lib/X11/$i ]; then - EtcToMove="$EtcToMove $i" + EtcDirToMove="$EtcDirToMove $i" + fi + done + for i in $ETCFLINKS; do + if [ -f $RUNDIR/lib/X11/$i -a ! $L $RUNDIR/lib/X11/$i ]; then + EtcFileToMove="$EtcFileToMove $i" fi done fi -if [ X"$EtcToMove" != X ]; then +if [ X"$EtcDirToMove" != X -o X"$EtcFileToMove" != X ]; then echo "XFree86 now installs most customisable configuration files under" echo "$ETCDIR instead of under $RUNDIR/lib/X11, and has symbolic links" echo "under $RUNDIR/lib/X11 that point to $ETCDIR. You currently have" echo "files under the following subdirectories of $RUNDIR/lib/X11:" echo "" - echo "$EtcToMove" + echo "$EtcDirToMove $EtcFileToMove" echo "" echo "Do you want to move them to $ETCDIR and create the necessary" Echo "links? (y/n) [y] " @@ -840,7 +851,7 @@ if [ X"$EtcToMove" != X ]; then esac echo "" if [ X"$NoSymLinks" != XYES ]; then - for i in $EtcToMove; do + for i in $EtcDirToMove; do echo "Moving $RUNDIR/lib/X11/$i to $ETCDIR/$i ..." if [ ! -d $ETCDIR/$i ]; then mkdir $ETCDIR/$i @@ -850,6 +861,12 @@ if [ X"$EtcToMove" != X ]; then rm -fr $RUNDIR/lib/X11/$i && \ ln -s $ETCDIR/$i $RUNDIR/lib/X11/$i done + for i in $EtcFileToMove; do + echo "Moving $RUNDIR/lib/X11/$i to $ETCDIR/$i ..." + cp -p $RUNDIR/lib/X11/$i $ETCDIR/$i && \ + rm -fr $RUNDIR/lib/X11/$i && \ + ln -s $ETCDIR/$i $RUNDIR/lib/X11/$i + done fi fi @@ -862,7 +879,7 @@ echo "Extracting $ETCDIST into a temporary location ..." rm -fr .etctmp mkdir .etctmp (cd .etctmp; $EXTRACT $WDIR/$ETCDIST) -for i in $ETCLINKS; do +for i in $ETCDLINKS; do DoCopy=YES if [ -d $RUNDIR/lib/X11/$i ]; then Echo "Do you want to overwrite the $i config files? (y/n) [n] " @@ -894,6 +911,30 @@ for i in $ETCLINKS; do $TAR -C $RUNDIR/lib/X11/$i -v -x -p -U -f - fi done +for i in $ETCFLINKS; do + DoCopy=YES + if [ -f $RUNDIR/lib/X11/$i ]; then + Echo "Do you want to overwrite the $i config file? (y/n) [n] " + read response + case "$response" in + [yY]*) + : OK + ;; + *) + DoCopy=NO + ;; + esac + fi + if [ $DoCopy = YES ]; then + echo "Installing the $i config file ..." + if [ X"$NoSymLinks" != XYES ]; then + if [ ! -f $RUNDIR/lib/X11/$i ]; then + ln -s $ETCDIR/$i $RUNDIR/lib/X11/$i + fi + fi + (set -x; cp -p .etctmp/$i $RUNDIR/lib/X11/$i) + fi +done if [ X"$XKBDIR" != X ]; then rm -fr $RUNDIR/lib/X11/xkb/compiled if [ X"$NoSymLinks" = XYES ]; then diff --git a/xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def b/xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def index 43db4801a..d8853c1a5 100644 --- a/xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def +++ b/xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def @@ -6,13 +6,14 @@ * - XFree86 doctools package (requires groff) * - nroff/troff or groff * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def,v 1.8 2000/12/15 21:54:37 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def,v 1.9 2001/04/23 15:54:04 dawes Exp $ */ #define HasSgmlFmt YES #define BuildAllDocs YES #define InstallJapaneseDocs YES +#define HasLatex YES #define BuildSpecsDocs YES #define SpecsDocDirs BDF CTEXT FSProtocol GL ICCCM ICE \ /*PEX5*/ PM Render SM X11 XDMCP XIM XLFD \ diff --git a/xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c b/xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c index f3de89f06..14a364218 100644 --- a/xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c +++ b/xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c @@ -24,7 +24,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c,v 1.8 2001/04/05 17:42:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c,v 1.9 2001/04/23 16:17:11 tsi Exp $ */ static const char identification[] = "$Identification: 18 $"; @@ -1090,10 +1090,14 @@ xf86SumOpenDevice(DeviceIntPtr pSum) static void xf86SumInitPrivate (SummaDevicePtr priv) { +#if defined (sun) && !defined(i386) + char *dev_name; +#endif + if (priv == NULL) return; #if defined(sun) && !defined(i386) - if (dev_name) { + if ((dev_name = getenv("SUMMASKETCH_DEV"))) { priv->sumDevice = xalloc(strlen(dev_name) + 1); strcpy(priv->sumDevice, dev_name); ErrorF("xf86SumOpen port changed to '%s'\n", priv->sumDevice); @@ -1333,9 +1337,6 @@ xf86SumAllocate(void) { LocalDevicePtr local; SummaDevicePtr priv; -#if defined (sun) && !defined(i386) - char *dev_name = getenv("SUMMASKETCH_DEV"); -#endif priv = xalloc(sizeof(SummaDeviceRec)); if (!priv) diff --git a/xc/programs/Xserver/hw/xfree86/int10/generic.c b/xc/programs/Xserver/hw/xfree86/int10/generic.c index a63501e9b..0cde994a1 100644 --- a/xc/programs/Xserver/hw/xfree86/int10/generic.c +++ b/xc/programs/Xserver/hw/xfree86/int10/generic.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/generic.c,v 1.17 2001/02/16 23:42:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/generic.c,v 1.18 2001/04/09 09:38:58 alanh Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -52,10 +52,22 @@ static void UnmapVRam(xf86Int10InfoPtr pInt); static void *sysMem = NULL; +typedef enum { + INT10OPT_NOINT10 +} INT10Opts; + +static OptionInfoRec INT10Options[] = { + { INT10OPT_NOINT10, "NoInt10", OPTV_BOOLEAN, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE }, +}; + +#define nINT10Options (sizeof(INT10Options) / sizeof(INT10Options[0])) + xf86Int10InfoPtr xf86InitInt10(int entityIndex) { xf86Int10InfoPtr pInt; + ScrnInfoPtr pScrn; int screen; void* base = 0; void* vbiosMem = 0; @@ -63,6 +75,19 @@ xf86InitInt10(int entityIndex) #ifdef _PC CARD32 cs; #endif + /* Default Int10 enabled. */ + Bool noint10 = FALSE; + OptionInfoRec options[nINT10Options]; + + pScrn = (xf86FindScreenForEntity(entityIndex)); + + (void)memcpy(options, INT10Options, sizeof(INT10Options)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); + + xf86GetOptValBool(options, INT10OPT_NOINT10, &noint10); + + if (noint10) + return NULL; screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex; diff --git a/xc/programs/Xserver/hw/xfree86/loader/Imakefile b/xc/programs/Xserver/hw/xfree86/loader/Imakefile index d34a84432..1123d0223 100644 --- a/xc/programs/Xserver/hw/xfree86/loader/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/loader/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/loader/Imakefile,v 1.26 2000/11/02 19:10:53 dawes Exp $ */ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/loader/Imakefile,v 1.27 2001/04/21 20:14:39 herrb Exp $ */ @@ -22,7 +22,7 @@ DLSRC=dlloader.c DLOBJ=dlloader.o #endif -DEFINES = $(DBMALLOCDEFINE) $(DLOPENDEFINES) $(OSDEFINES) +DEFINES = $(DBMALLOCDEFINE) $(DLOPENDEFINES) $(OS_DEFINES) MODULEDEFINES = -DDEFAULT_MODULE_PATH=\"$(MODULEDIR)\" diff --git a/xc/programs/Xserver/hw/xfree86/os-support/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/Imakefile index 9b30dd159..9c3eee263 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.43 2000/11/06 19:24:08 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/Imakefile,v 3.44 2001/04/23 12:08:14 alanh Exp $ @@ -34,10 +34,6 @@ OS_SUBDIR = sysv # endif #endif -#if defined(cygwinArchitecture) -OS_SUBDIR = cygwin -#endif - #if defined(SVR4Architecture) # if defined(SunArchitecture) # if OSMinorVersion < 8 diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c index f20bbaba1..e7df3fba4 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c,v 3.42 2001/02/27 23:05:00 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c,v 3.43 2001/04/22 08:48:51 herrb Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -118,10 +118,10 @@ struct memAccess ioMemInfo = { CONSOLE_GET_IO_INFO, NULL, NULL, #define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\ "\tin /etc/sysctl.conf and reboot your machine\n" \ "\trefer to xf86(4) for details\n" -#define SECURELEVEL_MSG \ - "A card in your system needs more than the aperture driver\n" \ - "\tYou need to rebuild a kernel with \"Option INSECURE\"\n" \ - "\tand set securelevel=-1 in /etc/rc.securelevel\n" +#define SYSCTL_MSG2 \ + "Check that you have set 'machdep.allowaperture=2'\n" \ + "\tin /etc/sysctl.conf and reboot your machine\n" \ + "\trefer to xf86(4) for details\n" #endif #ifdef __alpha__ @@ -433,7 +433,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, DEV_MEM, Len, Base, Offset, strerror(errno)); #ifdef __OpenBSD__ if (Base < 0xa0000) { - xf86Msg(X_WARNING, SECURELEVEL_MSG); + xf86Msg(X_WARNING, SYSCTL_MSG2); } #endif return(-1); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile index 3c29043b8..d28ff8a48 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile,v 1.4 2001/01/19 08:08:40 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile,v 1.5 2001/04/10 18:42:58 dawes Exp $ XCOMM $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile,v 1.7 1999/09/14 19:55:15 faith Exp $ #define IHaveModules @@ -58,6 +58,7 @@ DependSubdirs($(SUBDIRS)) #if DoLoadableServer LinkSourceFile(drmmodule.c,$(XF86OSSRC)/linux/drm) #endif +LinkSourceFile(xf86drm.c,$(XF86OSSRC)/linux/drm) LinkSourceFile(xf86drmHash.c,$(XF86OSSRC)/linux/drm) LinkSourceFile(xf86drmI810.c,$(XF86OSSRC)/linux/drm) LinkSourceFile(xf86drmMga.c,$(XF86OSSRC)/linux/drm) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile index f58193175..0e11ec504 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile @@ -1,7 +1,8 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile,v 1.4 2001/01/12 19:28:34 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile,v 1.6 2001/04/18 14:52:43 dawes Exp $ #include <Server.tmpl> +#if 0 LinkSourceFile(xf86drm.c,..) LinkSourceFile(xf86drmHash.c,..) LinkSourceFile(xf86drmRandom.c,..) @@ -9,6 +10,7 @@ LinkSourceFile(xf86drmSL.c,..) LinkSourceFile(xf86drm.h,$(XF86OSSRC)) LinkSourceFile(xf86_OSproc.h,$(XF86OSSRC)) LinkSourceFile(sigio.c,$(XF86OSSRC)/shared) +#endif XCOMM Try to use the Linux version of the DRM headers. This avoids skew XCOMM and missing headers. If there's a need to break them out, they @@ -35,7 +37,7 @@ install:: $(MAKE) -f Makefile.bsd install #else all:: - echo 'Use "make -f Makefile.bsd" to manually build drm.o' + @echo 'Use "make -f Makefile.bsd" to manually build drm.o' #endif clean:: diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile index 1adef2ef6..b4c282baf 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile @@ -3,7 +3,7 @@ XCOMM $XConsortium: Imakefile /main/16 1996/10/27 18:07:43 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile,v 1.15 2000/12/01 00:24:35 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile,v 1.16 2001/04/20 17:02:43 tsi Exp $ #include <Server.tmpl> @@ -14,16 +14,20 @@ XCOMM Alpha (Linux) PCI driver PCIDRVRSRC = axpPci.c PCIDRVROBJ = axpPci.o -#elif defined(LinuxArchitecture) && defined(SparcArchitecture) +#elif (defined(LinuxArchitecture) || defined(SunArchitecture)) && \ + defined(SparcArchitecture) -XCOMM Sparc (Linux) PCI driver +XCOMM Sparc PCI driver PCIDRVRSRC = sparcPci.c PCIDRVROBJ = sparcPci.o -SBUSDRVSRC = linuxSbus.c -SBUSDRVOBJ = linuxSbus.o +SBUSDRVSRC = Sbus.c +SBUSDRVOBJ = Sbus.o -#elif defined(LinuxArchitecture) && (defined(PpcArchitecture) || defined(MipsArchitecture) || defined(ia64Architecture)) +#elif defined(LinuxArchitecture) && \ + (defined(PpcArchitecture) || \ + defined(MipsArchitecture) || \ + defined(ia64Architecture)) XCOMM generic linux PCI driver (using /proc/bus/pci, requires kernel 2.2) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h b/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h index 2909d6776..0c006a55d 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h,v 1.16 2000/12/01 00:24:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h,v 1.17 2001/04/20 17:02:43 tsi Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -147,7 +147,7 @@ # if !defined(PowerMAX_OS) # define INCLUDE_XF86_MAP_PCI_MEM # endif -#elif defined(__sparc__) && defined(linux) +#elif defined(__sparc__) && (defined(linux) || defined(sun)) # define ARCH_PCI_INIT sparcPciInit # define INCLUDE_XF86_MAP_PCI_MEM #elif defined(__alpha__) && defined(linux) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c b/xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c new file mode 100644 index 000000000..b1d24471c --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c @@ -0,0 +1,582 @@ +/* + * SBUS and OpenPROM access functions. + * + * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c,v 1.1 2001/04/20 17:02:43 tsi Exp $ */ + +#include <fcntl.h> +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <sys/ioctl.h> +#include <sys/mman.h> +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" + +#include "xf86sbusBus.h" +#include "xf86Sbus.h" + +static int promFd = -1; +static int promRootNode, promCurrentNode; +static int promOpenCount = 0; +static int promP1275 = -1; +#define MAX_PROP 128 +#define MAX_VAL (4096-128-4) +static struct openpromio *promOpio; + +static int +promGetSibling(int node) +{ + promOpio->oprom_size = sizeof(int); + + if (node == -1) return 0; + *(int *)promOpio->oprom_array = node; + if (ioctl(promFd, OPROMNEXT, promOpio) < 0) + return 0; + promCurrentNode = *(int *)promOpio->oprom_array; + return *(int *)promOpio->oprom_array; +} + +static int +promGetChild(int node) +{ + promOpio->oprom_size = sizeof(int); + + if (!node || node == -1) return 0; + *(int *)promOpio->oprom_array = node; + if (ioctl(promFd, OPROMCHILD, promOpio) < 0) + return 0; + promCurrentNode = *(int *)promOpio->oprom_array; + return *(int *)promOpio->oprom_array; +} + +static char * +promGetProperty(const char *prop, int *lenp) +{ + promOpio->oprom_size = MAX_VAL; + + strcpy(promOpio->oprom_array, prop); + if (ioctl(promFd, OPROMGETPROP, promOpio) < 0) + return 0; + if (lenp) *lenp = promOpio->oprom_size; + return promOpio->oprom_array; +} + +static int +promGetBool(const char *prop) +{ + promOpio->oprom_size = 0; + + *(int *)promOpio->oprom_array = 0; + for (;;) { + promOpio->oprom_size = MAX_PROP; + if (ioctl(promFd, OPROMNXTPROP, promOpio) < 0) + return 0; + if (!promOpio->oprom_size) + return 0; + if (!strcmp(promOpio->oprom_array, prop)) + return 1; + } +} + +enum { + PROM_NODE_PCI = 16, + PROM_NODE_EBUS = 8, + PROM_NODE_SBUS = 4, + PROM_NODE_PREF = 2, + PROM_NODE_SIBLING = 1 +}; + +static int +promSetNode(sbusPromNodePtr pnode) +{ + int node; + + if (!pnode->node || pnode->node == -1) + return -1; + if (pnode->cookie[0] & PROM_NODE_SIBLING) + node = promGetSibling(pnode->cookie[1]); + else + node = promGetChild(pnode->cookie[1]); + if (pnode->node != node) + return -1; + return 0; +} + +static void +promIsP1275(void) +{ + FILE *f; + char buffer[1024]; + + if (promP1275 != -1) + return; + promP1275 = 0; + f = fopen("/proc/cpuinfo","r"); + if (!f) return; + while (fgets(buffer, 1024, f) != NULL) + if (!strncmp (buffer, "type", 4) && strstr (buffer, "sun4u")) { + promP1275 = 1; + break; + } + fclose(f); +} + +void +sparcPromClose(void) +{ + if (promOpenCount > 1) { + promOpenCount--; + return; + } + if (promFd != -1) { + close(promFd); + promFd = -1; + } + if (promOpio) { + xfree(promOpio); + promOpio = NULL; + } + promOpenCount = 0; +} + +int +sparcPromInit(void) +{ + if (promOpenCount) { + promOpenCount++; + return 0; + } + promFd = open("/dev/openprom", O_RDONLY, 0); + if (promFd == -1) + return -1; + promOpio = (struct openpromio *)xalloc(4096); + if (!promOpio) { + sparcPromClose(); + return -1; + } + promRootNode = promGetSibling(0); + if (!promRootNode) { + sparcPromClose(); + return -1; + } + promIsP1275(); + promOpenCount++; + + return 0; +} + +char * +sparcPromGetProperty(sbusPromNodePtr pnode, const char *prop, int *lenp) +{ + if (promSetNode(pnode)) + return NULL; + return promGetProperty(prop, lenp); +} + +int +sparcPromGetBool(sbusPromNodePtr pnode, const char *prop) +{ + if (promSetNode(pnode)) + return 0; + return promGetBool(prop); +} + +static sbusDevicePtr *devicePtrs; + +static void promWalk(int node, int oldnode, int flags) +{ + int nextnode; + int len, sbus = (flags & PROM_NODE_SBUS); + char *prop = promGetProperty("device_type", &len); + int devId, i, j; + sbusPromNode pNode, pNode2; + + while (prop) { + if (len <= 0 || strcmp(prop, "display")) + break; + prop = promGetProperty("name", &len); + if (!prop || len <= 0) + break; + while ((*prop >= 'A' && *prop <= 'Z') || *prop == ',') prop++; + if (!sbus && strcmp(prop, "ffb") && strcmp(prop, "afb") && + strcmp(prop, "cgfourteen")) + break; + /* + * All /SUNW,ffb outside of SBUS tree come before all + * /SUNW,afb outside of SBUS tree in Linux. + */ + if (!sbus && !strcmp(prop, "afb")) + flags |= PROM_NODE_PREF; + for (i = 0; sbusDeviceTable[i].devId; i++) + if (!strcmp(prop, sbusDeviceTable[i].promName)) + break; + devId = sbusDeviceTable[i].devId; + if (! devId) + break; + for (i = 0; i < 32; i++) { + if (! devicePtrs[i] || devicePtrs[i]->devId != devId) + continue; + if (devicePtrs[i]->node.node) { + if ((devicePtrs[i]->node.cookie[0] & ~PROM_NODE_SIBLING) <= + (flags & ~PROM_NODE_SIBLING)) + continue; + for (j = i + 1, pNode = devicePtrs[i]->node; j < 32; j++) { + if (! devicePtrs[j] || devicePtrs[j]->devId != devId) + continue; + pNode2 = devicePtrs[j]->node; + devicePtrs[j]->node = pNode; + pNode = pNode2; + } + } + devicePtrs[i]->node.node = node; + devicePtrs[i]->node.cookie[0] = flags; + devicePtrs[i]->node.cookie[1] = oldnode; + break; + } + break; + } + prop = promGetProperty("name", &len); + if (prop && len > 0) { + if (!strcmp(prop, "sbus") || !strcmp(prop, "sbi")) + sbus = PROM_NODE_SBUS; + } + nextnode = promGetChild(node); + if (nextnode) + promWalk(nextnode, node, sbus); + nextnode = promGetSibling(node); + if (nextnode) + promWalk(nextnode, node, PROM_NODE_SIBLING|sbus); +} + +void +sparcPromAssignNodes(void) +{ + sbusDevicePtr psdp, *psdpp; + int n, holes = 0, i, j; + FILE *f; + + devicePtrs = xnfcalloc(sizeof(sbusDevicePtr), 32); + for (psdpp = xf86SbusInfo, psdp = *psdpp, n = 0; psdp; psdp = *++psdpp, n++) { + if (psdp->fbNum != n) + holes = 1; + devicePtrs[psdp->fbNum] = psdp; + } + if (holes && (f = fopen("/proc/fb", "r")) != NULL) { + /* We could not open one of fb devices, check /proc/fb to see what + * were the types of the cards missed. */ + char buffer[64]; + int fbNum, devId; + static struct { + int devId; + char *prefix; + } procFbPrefixes[] = { + { SBUS_DEVICE_BW2, "BWtwo" }, + { SBUS_DEVICE_CG14, "CGfourteen" }, + { SBUS_DEVICE_CG6, "CGsix" }, + { SBUS_DEVICE_CG3, "CGthree" }, + { SBUS_DEVICE_FFB, "Creator" }, + { SBUS_DEVICE_FFB, "Elite 3D" }, + { SBUS_DEVICE_LEO, "Leo" }, + { SBUS_DEVICE_TCX, "TCX" }, + { 0, NULL }, + }; + + while (fscanf(f, "%d %63s\n", &fbNum, buffer) == 2) { + for (i = 0; procFbPrefixes[i].devId; i++) + if (! strncmp(procFbPrefixes[i].prefix, buffer, + strlen(procFbPrefixes[i].prefix))) + break; + devId = procFbPrefixes[i].devId; + if (! devId) continue; + if (devicePtrs[fbNum]) { + if (devicePtrs[fbNum]->devId != devId) + xf86ErrorF("Inconsistent /proc/fb with FBIOGATTR\n"); + } else if (!devicePtrs[fbNum]) { + devicePtrs[fbNum] = psdp = xnfcalloc(sizeof (sbusDevice), 1); + psdp->devId = devId; + psdp->fbNum = fbNum; + psdp->fd = -2; + } + } + fclose(f); + } + promGetSibling(0); + promWalk(promRootNode, 0, 2); + for (i = 0, j = 0; i < 32; i++) + if (devicePtrs[i] && devicePtrs[i]->fbNum == -1) + j++; + xf86SbusInfo = xnfrealloc(xf86SbusInfo, sizeof(psdp) * (n + j + 1)); + for (i = 0, psdpp = xf86SbusInfo; i < 32; i++) + if (devicePtrs[i]) { + if (devicePtrs[i]->fbNum == -1) { + memmove(psdpp + 1, psdpp, sizeof(psdpp) * (n + 1)); + *psdpp = devicePtrs[i]; + } else + n--; + } + xfree(devicePtrs); +} + +static char * +promGetReg(int type) +{ + char *prop; + int len; + static char regstr[40]; + + regstr[0] = 0; + prop = promGetProperty("reg", &len); + if (prop && len >= 4) { + unsigned int *reg = (unsigned int *)prop; + if (!promP1275 || (type == PROM_NODE_SBUS) || (type == PROM_NODE_EBUS)) + sprintf (regstr, "@%x,%x", reg[0], reg[1]); + else if (type == PROM_NODE_PCI) { + if ((reg[0] >> 8) & 7) + sprintf (regstr, "@%x,%x", (reg[0] >> 11) & 0x1f, (reg[0] >> 8) & 7); + else + sprintf (regstr, "@%x", (reg[0] >> 11) & 0x1f); + } else if (len == 4) + sprintf (regstr, "@%x", reg[0]); + else { + unsigned int regs[2]; + + /* Things get more complicated on UPA. If upa-portid exists, + then address is @upa-portid,second-int-in-reg, otherwise + it is @first-int-in-reg/16,second-int-in-reg (well, probably + upa-portid always exists, but just to be safe). */ + memcpy (regs, reg, sizeof(regs)); + prop = promGetProperty("upa-portid", &len); + if (prop && len == 4) { + reg = (unsigned int *)prop; + sprintf (regstr, "@%x,%x", reg[0], regs[1]); + } else + sprintf (regstr, "@%x,%x", regs[0] >> 4, regs[1]); + } + } + return regstr; +} + +static int +promWalk2(char *path, int parent, int node, int searchNode, int type) +{ + int nextnode; + int len, ntype = type; + char *prop, *p; + + prop = promGetProperty("name", &len); + *path = '/'; + if (!prop || len <= 0) + return 0; + if ((!strcmp(prop, "sbus") || !strcmp(prop, "sbi")) && !type) + ntype = PROM_NODE_SBUS; + else if (!strcmp(prop, "ebus") && type == PROM_NODE_PCI) + ntype = PROM_NODE_EBUS; + else if (!strcmp(prop, "pci") && !type) + ntype = PROM_NODE_PCI; + strcpy (path + 1, prop); + p = promGetReg(type); + if (*p) + strcat (path, p); + if (node == searchNode) + return 1; + nextnode = promGetChild(node); + if (nextnode && promWalk2(strchr (path, 0), node, nextnode, searchNode, ntype)) + return 1; + nextnode = promGetSibling(node); + if (nextnode && promWalk2(path, parent, nextnode, searchNode, type)) + return 1; + return 0; +} + +char * +sparcPromNode2Pathname(sbusPromNodePtr pnode) +{ + char *ret; + + if (!pnode->node) return NULL; + ret = xalloc(4096); + if (!ret) return NULL; + if (promWalk2(ret, promRootNode, promGetChild(promRootNode), pnode->node, 0)) + return ret; + xfree(ret); + return NULL; +} + +static int +promWalk3(char *name, char *regstr, int parent, int type) +{ + int len, node, ret; + char *prop, *p; + + for (;;) { + prop = promGetProperty("name", &len); + if (!prop || len <= 0) + return 0; + if ((!strcmp(prop, "sbus") || !strcmp(prop, "sbi")) && !type) + type = PROM_NODE_SBUS; + else if (!strcmp(prop, "ebus") && type == PROM_NODE_PCI) + type = PROM_NODE_EBUS; + else if (!strcmp(prop, "pci") && !type) + type = PROM_NODE_PCI; + for (node = promGetChild(parent); node; node = promGetSibling(node)) { + prop = promGetProperty("name", &len); + if (!prop || len <= 0) + continue; + if (*name && strcmp(name, prop)) + continue; + if (*regstr) { + p = promGetReg(type); + if (! *p || strcmp(p + 1, regstr)) + continue; + } + break; + } + if (!node) { + for (node = promGetChild(parent); node; node = promGetSibling(node)) { + ret = promWalk3(name, regstr, node, type); + if (ret) return ret; + } + return 0; + } + name = strchr(regstr, 0) + 1; + if (! *name) + return node; + p = strchr(name, '/'); + if (p) + *p = 0; + else + p = strchr(name, 0); + regstr = strchr(name, '@'); + if (regstr) + *regstr++ = 0; + else + regstr = p; + if (name == regstr) + return 0; + parent = node; + } +} + +int +sparcPromPathname2Node(const char *pathName) +{ + int i; + char *name, *regstr, *p; + + i = strlen(pathName); + name = xalloc(i + 2); + if (! name) return 0; + strcpy (name, pathName); + name [i + 1] = 0; + if (name[0] != '/') + return 0; + p = strchr(name + 1, '/'); + if (p) + *p = 0; + else + p = strchr(name, 0); + regstr = strchr(name, '@'); + if (regstr) + *regstr++ = 0; + else + regstr = p; + if (name + 1 == regstr) + return 0; + promGetSibling(0); + i = promWalk3(name + 1, regstr, promRootNode, 0); + xfree(name); + return i; +} + +pointer +xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, unsigned long size) +{ + pointer ret; + + if (psdp->fd == -1) { + psdp->fd = open(psdp->device, O_RDWR); + if (psdp->fd == -1) + return NULL; + } else if (psdp->fd < 0) + return NULL; + + ret = (pointer) mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, + psdp->fd, offset); + if (ret == (pointer) -1) { + ret = (pointer) mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, + psdp->fd, offset); + } + if (ret == (pointer) -1) + return NULL; + + return ret; +} + +void +xf86UnmapSbusMem(sbusDevicePtr psdp, pointer addr, unsigned long size) +{ + munmap (addr, size); +} + +/* Tell OS that we are driving the HW cursor ourselves. */ +void +xf86SbusHideOsHwCursor(sbusDevicePtr psdp) +{ + struct fbcursor fbcursor; + unsigned char zeros[8]; + + memset(&fbcursor, 0, sizeof(fbcursor)); + memset(&zeros, 0, sizeof(zeros)); + fbcursor.cmap.count = 2; + fbcursor.cmap.red = zeros; + fbcursor.cmap.green = zeros; + fbcursor.cmap.blue = zeros; + fbcursor.image = (char *)zeros; + fbcursor.mask = (char *)zeros; + fbcursor.size.x = 32; + fbcursor.size.y = 1; + fbcursor.set = FB_CUR_SETALL; + ioctl(psdp->fd, FBIOSCURSOR, &fbcursor); +} + +/* Set HW cursor colormap. */ +void +xf86SbusSetOsHwCursorCmap(sbusDevicePtr psdp, int bg, int fg) +{ + struct fbcursor fbcursor; + unsigned char red[2], green[2], blue[2]; + + memset(&fbcursor, 0, sizeof(fbcursor)); + red[0] = bg >> 16; + green[0] = bg >> 8; + blue[0] = bg; + red[1] = fg >> 16; + green[1] = fg >> 8; + blue[1] = fg; + fbcursor.cmap.count = 2; + fbcursor.cmap.red = red; + fbcursor.cmap.green = green; + fbcursor.cmap.blue = blue; + fbcursor.set = FB_CUR_SETCMAP; + ioctl(psdp->fd, FBIOSCURSOR, &fbcursor); +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c b/xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c index 0967641d7..71c5bafea 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c,v 1.3 2000/11/02 19:10:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c,v 1.4 2001/04/20 17:02:43 tsi Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -45,25 +45,25 @@ * SOFTWARE. */ -#include <stdio.h> -#include "compiler.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "Pci.h" +#if defined(linux) #include <asm/unistd.h> #ifndef __NR_pciconfig_read #define __NR_pciconfig_read 148 #define __NR_pciconfig_write 149 #endif +#endif /* * UltraSPARC platform specific PCI access functions */ -CARD32 sparcPciCfgRead(PCITAG tag, int off); -void sparcPciCfgWrite(PCITAG, int off, CARD32 val); -void sparcPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits); +static CARD32 sparcPciCfgRead(PCITAG tag, int off); +static void sparcPciCfgWrite(PCITAG, int off, CARD32 val); +static void sparcPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits); pciBusInfo_t sparcPci0 = { /* configMech */ PCI_CFG_MECH_OTHER, @@ -93,12 +93,13 @@ sparcPciInit() #if defined(linux) + /* * These funtions will work for Linux, but other OS's * are likely have a different mechanism for getting at * PCI configuration space */ -CARD32 +static CARD32 sparcPciCfgRead(PCITAG tag, int off) { int bus, dfn; @@ -111,7 +112,7 @@ sparcPciCfgRead(PCITAG tag, int off) return(val); } -void +static void sparcPciCfgWrite(PCITAG tag, int off, CARD32 val) { int bus, dfn; @@ -122,7 +123,7 @@ sparcPciCfgWrite(PCITAG tag, int off, CARD32 val) syscall(__NR_pciconfig_write, bus, dfn, off, 4, &val); } -void +static void sparcPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits) { int bus, dfn; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h b/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h index 050b01431..5fd1ae32d 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h @@ -20,18 +20,19 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h,v 1.2 2000/06/30 17:15:18 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h,v 1.3 2001/04/20 17:02:43 tsi Exp $ */ #ifndef _XF86_SBUS_H #define _XF86_SBUS_H -#ifdef linux +#if defined(linux) #include <asm/types.h> #include <asm/fbio.h> #include <asm/openpromio.h> #elif defined(SVR4) #include <sys/fbio.h> -#elif define(CSRG_BASED) +#include <sys/openpromio.h> +#elif defined(CSRG_BASED) #include <machine/fbio.h> #else #include <sun/fbio.h> diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile index 1b24a75a1..cf6ba5724 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile,v 1.3 2000/11/08 05:03:06 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile,v 1.4 2001/04/18 14:52:43 dawes Exp $ #include <Server.tmpl> @@ -12,7 +12,7 @@ all:: $(MAKE) -f Makefile.linux #else all:: - echo 'Use "make -f Makefile.linux" to manually build drm.o' + @echo 'Use "make -f Makefile.linux" to manually build drm.o' #endif clean:: diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux index 470c25b38..95044e6f8 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux @@ -47,7 +47,7 @@ # **** End of SMP/MODVERSIONS detection -MODS = gamma.o tdfx.o +MODS = gamma.o tdfx.o r128.o radeon.o LIBS = DRMTEMPLATES = drm_auth.h drm_bufs.h drm_context.h drm_dma.h drm_drawable.h \ @@ -61,6 +61,13 @@ GAMMAHEADERS = gamma_drv.h $(DRMHEADERS) $(DRMTEMPLATES) TDFXOBJS = tdfx_drv.o TDFXHEADERS = tdfx.h $(DRMHEADERS) +R128OBJS = r128_drv.o r128_cce.o r128_state.o +R128HEADERS = r128.h r128_drv.h r128_drm.h $(DRMHEADERS) $(DRMTEMPLATES) + +RADEONOBJS = radeon_drv.o radeon_cp.o radeon_state.o +RADEONHEADERS = radeon.h radeon_drv.h radeon_drm.h $(DRMHEADERS) \ + $(DRMTEMPLATES) + INC = /usr/include CFLAGS = -O2 $(WARNINGS) @@ -83,9 +90,10 @@ PRGLIBS = # This may not be correct, but it is the best assumption we can make. VERSION := $(shell uname -r) -A := /usr/src/linux-$(VERSION)/include -B := /usr/src/linux/include -C := /usr/include +A := /lib/modules/$(VERSION)/build/include +B := /usr/src/linux-$(VERSION)/include +C := /usr/src/linux/include +D := /usr/include V := $(shell gcc -E -nostdinc -I$A picker.c 2>/dev/null \ | grep -s 'RELEASE = ' | cut -d' ' -f3) @@ -100,15 +108,21 @@ else V := $(shell gcc -E -nostdinc -I$C picker.c 2>/dev/null \ | grep -s 'RELEASE = ' | cut -d' ' -f3) ifeq ($(V),"$(VERSION)") - TREE := $C + TREE := $C +else + V := $(shell gcc -E -nostdinc -I$D picker.c 2>/dev/null \ + | grep -s 'RELEASE = ' | cut -d' ' -f3) +ifeq ($(V),"$(VERSION)") + TREE := $D else TREE := 0 endif endif endif +endif ifeq ($(TREE),0) -all:; @echo Error: Could not locate kernel tree in $A $B $C +all:; @echo Error: Could not locate kernel tree in $A $B $C $D else SMP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \ | grep -s 'SMP = ' | cut -d' ' -f3) @@ -132,7 +146,7 @@ ifeq ($(AGP),1) MODCFLAGS += -DCONFIG_AGP -DCONFIG_AGP_MODULE DRMTEMPLATES += drm_agpsupport.h DRMHEADERS += agpsupport-pre24.h -MODS += mga.o r128.o radeon.o +MODS += mga.o ifeq ($(MACHINE),i386) MODS += i810.o endif @@ -140,19 +154,16 @@ ifeq ($(MACHINE),i686) MODS += i810.o endif - MGAOBJS = mga_drv.o mga_dma.o mga_state.o mga_warp.o MGAHEADERS = mga.h mga_drv.h mga_drm.h $(DRMHEADERS) $(DRMTEMPLATES) I810OBJS = i810_drv.o i810_dma.o I810HEADERS = i810.h i810_drv.h i810_drm.h $(DRMHEADERS) $(DRMTEMPLATES) -R128OBJS = r128_drv.o r128_cce.o r128_state.o -R128HEADERS = r128.h r128_drv.h r128_drm.h $(DRMHEADERS) $(DRMTEMPLATES) +endif -RADEONOBJS = radeon_drv.o radeon_cp.o radeon_state.o -RADEONHEADERS = radeon.h radeon_drv.h radeon_drm.h $(DRMHEADERS) \ - $(DRMTEMPLATES) +ifeq ($(MACHINE),alpha) +MODCFLAGS+= -ffixed-8 -mno-fp-regs -mcpu=ev56 -Wa,-mev6 endif ifeq ($(SIS),1) @@ -218,26 +229,27 @@ tdfx.o: $(TDFXOBJS) $(LIBS) sis.o: $(SISOBJS) $(LIBS) $(LD) -r $^ -o $@ -ifeq ($(AGP),1) -mga_drv.o: mga_drv.c +r128_drv.o: r128_drv.c $(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@ -mga.o: $(MGAOBJS) +r128.o: $(R128OBJS) $(LIBS) $(LD) -r $^ -o $@ -i810_drv.o: i810_drv.c +radeon_drv.o: radeon_drv.c $(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@ -i810.o: $(I810OBJS) $(LIBS) +radeon.o: $(RADEONOBJS) $(LIBS) $(LD) -r $^ -o $@ -r128_drv.o: r128_drv.c +ifeq ($(AGP),1) +mga_drv.o: mga_drv.c $(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@ -r128.o: $(R128OBJS) $(LIBS) +mga.o: $(MGAOBJS) $(LD) -r $^ -o $@ -radeon_drv.o: radeon_drv.c +i810_drv.o: i810_drv.c $(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@ -radeon.o: $(RADEONOBJS) $(LIBS) +i810.o: $(I810OBJS) $(LIBS) $(LD) -r $^ -o $@ + endif .PHONY: ChangeLog diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ati_pcigart.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ati_pcigart.h new file mode 100644 index 000000000..93c5148fb --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ati_pcigart.h @@ -0,0 +1,138 @@ +/* ati_pcigart.h -- ATI PCI GART support -*- linux-c -*- + * Created: Wed Dec 13 21:52:19 2000 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +#if PAGE_SIZE == 8192 +# define ATI_PCIGART_TABLE_ORDER 2 +# define ATI_PCIGART_TABLE_PAGES (1 << 2) +#elif PAGE_SIZE == 4096 +# define ATI_PCIGART_TABLE_ORDER 3 +# define ATI_PCIGART_TABLE_PAGES (1 << 3) +#elif +# error - PAGE_SIZE not 8K or 4K +#endif + +# define ATI_MAX_PCIGART_PAGES 8192 /* 32 MB aperture, 4K pages */ +# define ATI_PCIGART_PAGE_SIZE 4096 /* PCI GART page size */ + +static unsigned long DRM(ati_alloc_pcigart_table)( void ) +{ + unsigned long address; + struct page *page; + int i; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + address = __get_free_pages( GFP_KERNEL, ATI_PCIGART_TABLE_ORDER ); + if ( address == 0UL ) { + return 0; + } + + page = virt_to_page( address ); + + for ( i = 0 ; i <= ATI_PCIGART_TABLE_PAGES ; i++, page++ ) { + atomic_inc( &page->count ); + SetPageReserved( page ); + } + + DRM_DEBUG( "%s: returning 0x%08lx\n", __FUNCTION__, address ); + return address; +} + +static void DRM(ati_free_pcigart_table)( unsigned long address ) +{ + struct page *page; + int i; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + if ( !address ) return; + + page = virt_to_page( address ); + + for ( i = 0 ; i <= ATI_PCIGART_TABLE_PAGES ; i++, page++ ) { + atomic_dec( &page->count ); + ClearPageReserved( page ); + } + + free_pages( address, ATI_PCIGART_TABLE_ORDER ); +} + +unsigned long DRM(ati_pcigart_init)( drm_device_t *dev ) +{ + drm_sg_mem_t *entry = dev->sg; + unsigned long address; + unsigned long pages; + u32 *pci_gart, page_base; + int i, j; + + if ( !entry ) { + DRM_ERROR( "no scatter/gather memory!\n" ); + return 0; + } + + address = DRM(ati_alloc_pcigart_table)(); + if ( !address ) { + DRM_ERROR( "cannot allocate PCI GART page!\n" ); + return 0; + } + + pci_gart = (u32 *)address; + + pages = ( entry->pages <= ATI_MAX_PCIGART_PAGES ) + ? entry->pages : ATI_MAX_PCIGART_PAGES; + + memset( pci_gart, 0, ATI_MAX_PCIGART_PAGES * sizeof(u32) ); + + for ( i = 0 ; i < pages ; i++ ) { + page_base = virt_to_bus( entry->pagelist[i]->virtual ); + for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) { + *pci_gart++ = cpu_to_le32( page_base ); + page_base += ATI_PCIGART_PAGE_SIZE; + } + } + +#if __i386__ + asm volatile ( "wbinvd" ::: "memory" ); +#else + mb(); +#endif + + return address; +} + +int DRM(ati_pcigart_cleanup)( unsigned long address ) +{ + + if ( address ) { + DRM(ati_free_pcigart_table)( address ); + } + + return 0; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h index f1abaabff..3def97f74 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h @@ -126,10 +126,11 @@ typedef struct drm_control { } drm_control_t; typedef enum drm_map_type { - _DRM_FRAME_BUFFER = 0, /* WC (no caching), no core dump */ - _DRM_REGISTERS = 1, /* no caching, no core dump */ - _DRM_SHM = 2, /* shared, cached */ - _DRM_AGP = 3 /* AGP/GART */ + _DRM_FRAME_BUFFER = 0, /* WC (no caching), no core dump */ + _DRM_REGISTERS = 1, /* no caching, no core dump */ + _DRM_SHM = 2, /* shared, cached */ + _DRM_AGP = 3, /* AGP/GART */ + _DRM_SCATTER_GATHER = 4 /* Scatter/gather memory for PCI DMA */ } drm_map_type_t; typedef enum drm_map_flags { @@ -238,7 +239,8 @@ typedef struct drm_buf_desc { int high_mark; /* High water mark */ enum { _DRM_PAGE_ALIGN = 0x01, /* Align on page boundaries for DMA */ - _DRM_AGP_BUFFER = 0x02 /* Buffer is in agp space */ + _DRM_AGP_BUFFER = 0x02, /* Buffer is in agp space */ + _DRM_SG_BUFFER = 0x04 /* Scatter/gather memory buffer */ } flags; unsigned long agp_start; /* Start address of where the agp buffers * are in the agp aperture */ @@ -344,6 +346,11 @@ typedef struct drm_agp_info { unsigned short id_device; } drm_agp_info_t; +typedef struct drm_scatter_gather { + unsigned long size; /* In bytes -- will round to page boundary */ + unsigned long handle; /* Used for mapping / unmapping */ +} drm_scatter_gather_t; + #define DRM_IOCTL_BASE 'd' #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) #define DRM_IOR(nr,size) _IOR(DRM_IOCTL_BASE,nr,size) @@ -399,6 +406,9 @@ typedef struct drm_agp_info { #define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t) #define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t) +#define DRM_IOCTL_SG_ALLOC DRM_IOW( 0x38, drm_scatter_gather_t) +#define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, drm_scatter_gather_t) + /* MGA specific ioctls */ #define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t) #define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x41, drm_lock_t) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h index 274e318aa..227ec35a3 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h @@ -53,7 +53,7 @@ #include <linux/sched.h> #include <linux/smp_lock.h> /* For (un)lock_kernel */ #include <linux/mm.h> -#ifdef __alpha__ +#if defined(__alpha__) || defined(__powerpc__) #include <asm/pgtable.h> /* For pte_wrprotect */ #endif #include <asm/io.h> @@ -145,6 +145,7 @@ #define DRM_MEM_BOUNDAGP 17 #define DRM_MEM_CTXBITMAP 18 #define DRM_MEM_STUB 19 +#define DRM_MEM_SGLISTS 20 #define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) @@ -199,7 +200,7 @@ __cmpxchg_u32(volatile int *m, int old, int new) unsigned long prev, cmp; __asm__ __volatile__( - "1: ldl_l %0,%2\n" + "1: ldl_l %0,%5\n" " cmpeq %0,%3,%1\n" " beq %1,2f\n" " mov %4,%1\n" @@ -210,7 +211,8 @@ __cmpxchg_u32(volatile int *m, int old, int new) "3: br 1b\n" ".previous" : "=&r"(prev), "=&r"(cmp), "=m"(*m) - : "r"((long) old), "r"(new), "m"(*m)); + : "r"((long) old), "r"(new), "m"(*m) + : "memory" ); return prev; } @@ -221,7 +223,7 @@ __cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) unsigned long prev, cmp; __asm__ __volatile__( - "1: ldq_l %0,%2\n" + "1: ldq_l %0,%5\n" " cmpeq %0,%3,%1\n" " beq %1,2f\n" " mov %4,%1\n" @@ -232,7 +234,8 @@ __cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) "3: br 1b\n" ".previous" : "=&r"(prev), "=&r"(cmp), "=m"(*m) - : "r"((long) old), "r"(new), "m"(*m)); + : "r"((long) old), "r"(new), "m"(*m) + : "memory" ); return prev; } @@ -284,12 +287,43 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, return old; } +#elif defined(__powerpc__) +extern void __cmpxchg_called_with_bad_pointer(void); +static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, + unsigned long new, int size) +{ + unsigned long prev; + + switch (size) { + case 4: + __asm__ __volatile__( + "sync;" + "0: lwarx %0,0,%1 ;" + " cmpl 0,%0,%3;" + " bne 1f;" + " stwcx. %2,0,%1;" + " bne- 0b;" + "1: " + "sync;" + : "=&r"(prev) + : "r"(ptr), "r"(new), "r"(old) + : "cr0", "memory"); + return prev; + } + __cmpxchg_called_with_bad_pointer(); + return old; +} + +#endif /* i386, powerpc & alpha */ + +#ifndef __alpha__ #define cmpxchg(ptr,o,n) \ ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o), \ (unsigned long)(n),sizeof(*(ptr)))) -#endif /* i386 & alpha */ #endif +#endif /* !__HAVE_ARCH_CMPXCHG */ + /* Macros to make printk easier */ #define DRM_ERROR(fmt, arg...) \ printk(KERN_ERR "[" DRM_NAME ":" __FUNCTION__ "] *ERROR* " fmt , ##arg) @@ -547,7 +581,8 @@ typedef struct drm_device_dma { unsigned long *pagelist; unsigned long byte_count; enum { - _DRM_DMA_USE_AGP = 0x01 + _DRM_DMA_USE_AGP = 0x01, + _DRM_DMA_USE_SG = 0x02 } flags; /* DMA support */ @@ -579,6 +614,13 @@ typedef struct drm_agp_head { } drm_agp_head_t; #endif +typedef struct drm_sg_mem { + unsigned long handle; + void *virtual; + int pages; + struct page **pagelist; +} drm_sg_mem_t; + typedef struct drm_sigdata { int context; drm_hw_lock_t *lock; @@ -667,6 +709,10 @@ typedef struct drm_device { #if __REALLY_HAVE_AGP drm_agp_head_t *agp; #endif +#ifdef __alpha__ + struct pci_controler *hose; +#endif + drm_sg_mem_t *sg; /* Scatter gather memory */ unsigned long *ctx_bitmap; void *dev_private; drm_sigdata_t sigdata; /* For block_all_signals */ @@ -718,6 +764,9 @@ extern unsigned long DRM(vm_shm_nopage)(struct vm_area_struct *vma, extern unsigned long DRM(vm_dma_nopage)(struct vm_area_struct *vma, unsigned long address, int write_access); +extern unsigned long DRM(vm_sg_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access); #else /* Return type changed in 2.3.23 */ extern struct page *DRM(vm_nopage)(struct vm_area_struct *vma, @@ -729,6 +778,9 @@ extern struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma, extern struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma, unsigned long address, int write_access); +extern struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access); #endif extern void DRM(vm_open)(struct vm_area_struct *vma); extern void DRM(vm_close)(struct vm_area_struct *vma); @@ -947,5 +999,18 @@ extern int DRM(proc_cleanup)(int minor, struct proc_dir_entry *root, struct proc_dir_entry *dev_root); +#if __HAVE_SG + /* Scatter Gather Support (drm_scatter.h) */ +extern void DRM(sg_cleanup)(drm_sg_mem_t *entry); +extern int DRM(sg_alloc)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(sg_free)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +#endif + + /* ATI PCIGART support (ati_pcigart.h) */ +extern unsigned long DRM(ati_pcigart_init)(drm_device_t *dev); +extern int DRM(ati_pcigart_cleanup)(unsigned long address); + #endif /* __KERNEL__ */ #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h index dfd0d8fc2..9b056c75f 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h @@ -52,7 +52,8 @@ int DRM(agp_info)(struct inode *inode, struct file *filp, agp_kern_info *kern; drm_agp_info_t info; - if (!dev->agp->acquired || !drm_agp->copy_info) return -EINVAL; + if (!dev->agp || !dev->agp->acquired || !drm_agp->copy_info) + return -EINVAL; kern = &dev->agp->agp_info; info.agp_version_major = kern->version.major; @@ -77,7 +78,8 @@ int DRM(agp_acquire)(struct inode *inode, struct file *filp, drm_device_t *dev = priv->dev; int retcode; - if (!dev->agp|| dev->agp->acquired || !drm_agp->acquire) return -EINVAL; + if (!dev->agp || dev->agp->acquired || !drm_agp->acquire) + return -EINVAL; if ((retcode = drm_agp->acquire())) return retcode; dev->agp->acquired = 1; return 0; @@ -89,7 +91,8 @@ int DRM(agp_release)(struct inode *inode, struct file *filp, drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - if (!dev->agp->acquired || !drm_agp->release) return -EINVAL; + if (!dev->agp || !dev->agp->acquired || !drm_agp->release) + return -EINVAL; drm_agp->release(); dev->agp->acquired = 0; return 0; @@ -108,7 +111,8 @@ int DRM(agp_enable)(struct inode *inode, struct file *filp, drm_device_t *dev = priv->dev; drm_agp_mode_t mode; - if (!dev->agp->acquired || !drm_agp->enable) return -EINVAL; + if (!dev->agp || !dev->agp->acquired || !drm_agp->enable) + return -EINVAL; if (copy_from_user(&mode, (drm_agp_mode_t *)arg, sizeof(mode))) return -EFAULT; @@ -131,7 +135,7 @@ int DRM(agp_alloc)(struct inode *inode, struct file *filp, unsigned long pages; u32 type; - if (!dev->agp->acquired) return -EINVAL; + if (!dev->agp || !dev->agp->acquired) return -EINVAL; if (copy_from_user(&request, (drm_agp_buffer_t *)arg, sizeof(request))) return -EFAULT; if (!(entry = DRM(alloc)(sizeof(*entry), DRM_MEM_AGPLISTS))) @@ -188,7 +192,7 @@ int DRM(agp_unbind)(struct inode *inode, struct file *filp, drm_agp_binding_t request; drm_agp_mem_t *entry; - if (!dev->agp->acquired) return -EINVAL; + if (!dev->agp || !dev->agp->acquired) return -EINVAL; if (copy_from_user(&request, (drm_agp_binding_t *)arg, sizeof(request))) return -EFAULT; if (!(entry = DRM(agp_lookup_entry)(dev, request.handle))) @@ -207,7 +211,8 @@ int DRM(agp_bind)(struct inode *inode, struct file *filp, int retcode; int page; - if (!dev->agp->acquired || !drm_agp->bind_memory) return -EINVAL; + if (!dev->agp || !dev->agp->acquired || !drm_agp->bind_memory) + return -EINVAL; if (copy_from_user(&request, (drm_agp_binding_t *)arg, sizeof(request))) return -EFAULT; if (!(entry = DRM(agp_lookup_entry)(dev, request.handle))) @@ -229,7 +234,7 @@ int DRM(agp_free)(struct inode *inode, struct file *filp, drm_agp_buffer_t request; drm_agp_mem_t *entry; - if (!dev->agp->acquired) return -EINVAL; + if (!dev->agp || !dev->agp->acquired) return -EINVAL; if (copy_from_user(&request, (drm_agp_buffer_t *)arg, sizeof(request))) return -EFAULT; if (!(entry = DRM(agp_lookup_entry)(dev, request.handle))) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h index 63cfb0d44..16af7bd54 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h @@ -37,6 +37,10 @@ #define __HAVE_PCI_DMA 0 #endif +#ifndef __HAVE_SG +#define __HAVE_SG 0 +#endif + #ifndef DRIVER_BUF_PRIV_T #define DRIVER_BUF_PRIV_T u32 #endif @@ -103,13 +107,16 @@ int DRM(addmap)( struct inode *inode, struct file *filp, switch ( map->type ) { case _DRM_REGISTERS: case _DRM_FRAME_BUFFER: -#ifndef __sparc__ +#if !defined(__sparc__) && !defined(__alpha__) if ( map->offset + map->size < map->offset || map->offset < virt_to_phys(high_memory) ) { DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); return -EINVAL; } #endif +#ifdef __alpha__ + map->offset += dev->hose->mem_space->start; +#endif #if __REALLY_HAVE_MTRR if ( map->type == _DRM_FRAME_BUFFER || (map->flags & _DRM_WRITE_COMBINING) ) { @@ -135,10 +142,21 @@ int DRM(addmap)( struct inode *inode, struct file *filp, break; #if __REALLY_HAVE_AGP case _DRM_AGP: +#ifdef __alpha__ + map->offset += dev->hose->mem_space->start; +#endif map->offset = map->offset + dev->agp->base; map->mtrr = dev->agp->agp_mtrr; /* for getmap */ break; #endif + case _DRM_SCATTER_GATHER: + if (!dev->sg) { + DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); + return -EINVAL; + } + map->offset = map->offset + dev->sg->handle; + break; + default: DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); return -EINVAL; @@ -237,6 +255,7 @@ int DRM(rmmap)(struct inode *inode, struct file *filp, vfree(map->handle); break; case _DRM_AGP: + case _DRM_SCATTER_GATHER: break; } DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); @@ -565,6 +584,159 @@ int DRM(addbufs_pci)( struct inode *inode, struct file *filp, } #endif /* __HAVE_PCI_DMA */ +#ifdef __HAVE_SG +int DRM(addbufs_sg)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_buf_desc_t request; + drm_buf_entry_t *entry; + drm_buf_t *buf; + unsigned long offset; + unsigned long agp_offset; + int count; + int order; + int size; + int alignment; + int page_order; + int total; + int byte_count; + int i; + + if ( !dma ) return -EINVAL; + + if ( copy_from_user( &request, (drm_buf_desc_t *)arg, + sizeof(request) ) ) + return -EFAULT; + + count = request.count; + order = DRM(order)( request.size ); + size = 1 << order; + + alignment = (request.flags & _DRM_PAGE_ALIGN) + ? PAGE_ALIGN(size) : size; + page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; + total = PAGE_SIZE << page_order; + + byte_count = 0; + agp_offset = request.agp_start; + + DRM_DEBUG( "count: %d\n", count ); + DRM_DEBUG( "order: %d\n", order ); + DRM_DEBUG( "size: %d\n", size ); + DRM_DEBUG( "agp_offset: %ld\n", agp_offset ); + DRM_DEBUG( "alignment: %d\n", alignment ); + DRM_DEBUG( "page_order: %d\n", page_order ); + DRM_DEBUG( "total: %d\n", total ); + + if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL; + if ( dev->queue_count ) return -EBUSY; /* Not while in use */ + + spin_lock( &dev->count_lock ); + if ( dev->buf_use ) { + spin_unlock( &dev->count_lock ); + return -EBUSY; + } + atomic_inc( &dev->buf_alloc ); + spin_unlock( &dev->count_lock ); + + down( &dev->struct_sem ); + entry = &dma->bufs[order]; + if ( entry->buf_count ) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; /* May only call once for each order */ + } + + entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist), + DRM_MEM_BUFS ); + if ( !entry->buflist ) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + memset( entry->buflist, 0, count * sizeof(*entry->buflist) ); + + entry->buf_size = size; + entry->page_order = page_order; + + offset = 0; + + while ( entry->buf_count < count ) { + buf = &entry->buflist[entry->buf_count]; + buf->idx = dma->buf_count + entry->buf_count; + buf->total = alignment; + buf->order = order; + buf->used = 0; + + buf->offset = (dma->byte_count + offset); + buf->bus_address = agp_offset + offset; + buf->address = (void *)(agp_offset + offset + dev->sg->handle); + buf->next = NULL; + buf->waiting = 0; + buf->pending = 0; + init_waitqueue_head( &buf->dma_wait ); + buf->pid = 0; + + buf->dev_priv_size = sizeof(DRIVER_BUF_PRIV_T); + buf->dev_private = DRM(alloc)( sizeof(DRIVER_BUF_PRIV_T), + DRM_MEM_BUFS ); + memset( buf->dev_private, 0, buf->dev_priv_size ); + +#if __HAVE_DMA_HISTOGRAM + buf->time_queued = 0; + buf->time_dispatched = 0; + buf->time_completed = 0; + buf->time_freed = 0; +#endif + DRM_DEBUG( "buffer %d @ %p\n", + entry->buf_count, buf->address ); + + offset += alignment; + entry->buf_count++; + byte_count += PAGE_SIZE << page_order; + } + + DRM_DEBUG( "byte_count: %d\n", byte_count ); + + dma->buflist = DRM(realloc)( dma->buflist, + dma->buf_count * sizeof(*dma->buflist), + (dma->buf_count + entry->buf_count) + * sizeof(*dma->buflist), + DRM_MEM_BUFS ); + for ( i = 0 ; i < entry->buf_count ; i++ ) { + dma->buflist[i + dma->buf_count] = &entry->buflist[i]; + } + + dma->buf_count += entry->buf_count; + dma->byte_count += byte_count; + + DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count ); + DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count ); + +#if __HAVE_DMA_FREELIST + DRM(freelist_create)( &entry->freelist, entry->buf_count ); + for ( i = 0 ; i < entry->buf_count ; i++ ) { + DRM(freelist_put)( dev, &entry->freelist, &entry->buflist[i] ); + } +#endif + up( &dev->struct_sem ); + + request.count = entry->buf_count; + request.size = size; + + if ( copy_to_user( (drm_buf_desc_t *)arg, &request, sizeof(request) ) ) + return -EFAULT; + + dma->flags = _DRM_DMA_USE_SG; + + atomic_dec( &dev->buf_alloc ); + return 0; +} +#endif /* __HAVE_SG */ + int DRM(addbufs)( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ) { @@ -579,6 +751,11 @@ int DRM(addbufs)( struct inode *inode, struct file *filp, return DRM(addbufs_agp)( inode, filp, cmd, arg ); else #endif +#if __HAVE_SG + if ( request.flags & _DRM_SG_BUFFER ) + return DRM(addbufs_sg)( inode, filp, cmd, arg ); + else +#endif #if __HAVE_PCI_DMA return DRM(addbufs_pci)( inode, filp, cmd, arg ); #else @@ -760,7 +937,8 @@ int DRM(mapbufs)( struct inode *inode, struct file *filp, return -EFAULT; if ( request.count >= dma->buf_count ) { - if ( __HAVE_AGP && (dma->flags & _DRM_DMA_USE_AGP) ) { + if ( (__HAVE_AGP && (dma->flags & _DRM_DMA_USE_AGP)) || + (__HAVE_SG && (dma->flags & _DRM_DMA_USE_SG)) ) { drm_map_t *map = DRIVER_AGP_BUFFERS_MAP( dev ); if ( !map ) { @@ -768,18 +946,34 @@ int DRM(mapbufs)( struct inode *inode, struct file *filp, goto done; } +#if LINUX_VERSION_CODE <= 0x020402 down( ¤t->mm->mmap_sem ); +#else + down_write( ¤t->mm->mmap_sem ); +#endif virtual = do_mmap( filp, 0, map->size, PROT_READ | PROT_WRITE, MAP_SHARED, (unsigned long)map->offset ); +#if LINUX_VERSION_CODE <= 0x020402 up( ¤t->mm->mmap_sem ); +#else + up_write( ¤t->mm->mmap_sem ); +#endif } else { +#if LINUX_VERSION_CODE <= 0x020402 down( ¤t->mm->mmap_sem ); +#else + down_write( ¤t->mm->mmap_sem ); +#endif virtual = do_mmap( filp, 0, dma->byte_count, PROT_READ | PROT_WRITE, MAP_SHARED, 0 ); +#if LINUX_VERSION_CODE <= 0x020402 up( ¤t->mm->mmap_sem ); +#else + up_write( ¤t->mm->mmap_sem ); +#endif } if ( virtual > -1024UL ) { /* Real error */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h index 7447ca6d4..5337646f7 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h @@ -81,6 +81,9 @@ #ifndef __HAVE_COUNTERS #define __HAVE_COUNTERS 0 #endif +#ifndef __HAVE_SG +#define __HAVE_SG 0 +#endif #ifndef DRIVER_PREINIT #define DRIVER_PREINIT() @@ -178,6 +181,11 @@ static drm_ioctl_desc_t DRM(ioctls)[] = { [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { DRM(agp_unbind), 1, 1 }, #endif +#if __HAVE_SG + [DRM_IOCTL_NR(DRM_IOCTL_SG_ALLOC)] = { DRM(sg_alloc), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_SG_FREE)] = { DRM(sg_free), 1, 1 }, +#endif + DRIVER_IOCTLS }; @@ -415,6 +423,17 @@ static int DRM(takedown)( drm_device_t *dev ) * handled in the AGP/GART driver. */ break; + case _DRM_SCATTER_GATHER: + /* Handle it, but do nothing, if HAVE_SG + * isn't defined. + */ +#if __HAVE_SG + if(dev->sg) { + DRM(sg_cleanup)(dev->sg); + dev->sg = NULL; + } +#endif + break; } DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h index dd5747669..75752b3ac 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h @@ -70,6 +70,21 @@ int DRM(open_helper)(struct inode *inode, struct file *filp, drm_device_t *dev) } up(&dev->struct_sem); +#ifdef __alpha__ + /* + * Default the hose + */ + if (!dev->hose) { + struct pci_dev *pci_dev; + pci_dev = pci_find_class(PCI_CLASS_DISPLAY_VGA << 8, NULL); + if (pci_dev) dev->hose = pci_dev->sysdata; + if (!dev->hose) { + struct pci_bus *b = pci_bus_b(pci_root_buses.next); + if (b) dev->hose = b->sysdata; + } + } +#endif + return 0; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h index 9ae984147..d9d8e3a23 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h @@ -32,7 +32,11 @@ #define __NO_VERSION__ #include "drmP.h" +#if 0 +int DRM(flags) = DRM_FLAG_DEBUG; +#else int DRM(flags) = 0; +#endif /* drm_parse_option parses a single option. See description for * drm_parse_options for details. diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h index 2fba6b0c2..1cc8f31f0 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h @@ -95,6 +95,27 @@ int DRM(setunique)(struct inode *inode, struct file *filp, DRM_MEM_DRIVER); sprintf(dev->devname, "%s@%s", dev->name, dev->unique); +#ifdef __alpha__ + do { + struct pci_dev *pci_dev; + int b, d, f; + char *p; + + for(p = dev->unique; p && *p && *p != ':'; p++); + if (!p || !*p) break; + b = (int)simple_strtoul(p+1, &p, 10); + if (*p != ':') break; + d = (int)simple_strtoul(p+1, &p, 10); + if (*p != ':') break; + f = (int)simple_strtoul(p+1, &p, 10); + if (*p) break; + + pci_dev = pci_find_slot(b, PCI_DEVFN(d,f)); + if (pci_dev) + dev->hose = pci_dev->sysdata; + } while(0); +#endif + return 0; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h index 1763d9b41..498937d4c 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h @@ -63,6 +63,7 @@ static drm_mem_stats_t DRM(mem_stats)[] = { [DRM_MEM_MAPPINGS] = { "mappings" }, [DRM_MEM_BUFLISTS] = { "buflists" }, [DRM_MEM_AGPLISTS] = { "agplist" }, + [DRM_MEM_SGLISTS] = { "sglist" }, [DRM_MEM_TOTALAGP] = { "totalagp" }, [DRM_MEM_BOUNDAGP] = { "boundagp" }, [DRM_MEM_CTXBITMAP] = { "ctxbitmap"}, diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_scatter.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_scatter.h new file mode 100644 index 000000000..a0371074e --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_scatter.h @@ -0,0 +1,218 @@ +/* drm_scatter.h -- IOCTLs to manage scatter/gather memory -*- linux-c -*- + * Created: Mon Dec 18 23:20:54 2000 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include <linux/config.h> +#include <linux/vmalloc.h> +#include "drmP.h" + +#define DEBUG_SCATTER 0 + +void DRM(sg_cleanup)( drm_sg_mem_t *entry ) +{ + struct page *page; + int i; + + for ( i = 0 ; i < entry->pages ; i++ ) { + page = entry->pagelist[i]; + if ( page ) + ClearPageReserved( page ); + } + + vfree( entry->virtual ); + + DRM(free)( entry->pagelist, + entry->pages * sizeof(*entry->pagelist), + DRM_MEM_PAGES ); + DRM(free)( entry, + sizeof(*entry), + DRM_MEM_SGLISTS ); +} + +int DRM(sg_alloc)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_scatter_gather_t request; + drm_sg_mem_t *entry; + unsigned long pages, i, j; + pgd_t *pgd; + pmd_t *pmd; + pte_t *pte; + + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + if ( dev->sg ) + return -EINVAL; + + if ( copy_from_user( &request, + (drm_scatter_gather_t *)arg, + sizeof(request) ) ) + return -EFAULT; + + entry = DRM(alloc)( sizeof(*entry), DRM_MEM_SGLISTS ); + if ( !entry ) + return -ENOMEM; + + memset( entry, 0, sizeof(*entry) ); + + pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE; + DRM_DEBUG( "sg size=%ld pages=%ld\n", request.size, pages ); + + entry->pages = pages; + entry->pagelist = DRM(alloc)( pages * sizeof(*entry->pagelist), + DRM_MEM_PAGES ); + if ( !entry->pagelist ) { + DRM(free)( entry, sizeof(*entry), DRM_MEM_SGLISTS ); + return -ENOMEM; + } + + entry->virtual = vmalloc_32( pages << PAGE_SHIFT ); + if ( !entry->virtual ) { + DRM(free)( entry->pagelist, + entry->pages * sizeof(*entry->pagelist), + DRM_MEM_PAGES ); + DRM(free)( entry, + sizeof(*entry), + DRM_MEM_SGLISTS ); + return -ENOMEM; + } + + /* This also forces the mapping of COW pages, so our page list + * will be valid. Please don't remove it... + */ + memset( entry->virtual, 0, pages << PAGE_SHIFT ); + + entry->handle = (unsigned long)entry->virtual; + + DRM_DEBUG( "sg alloc handle = %08lx\n", entry->handle ); + DRM_DEBUG( "sg alloc virtual = %p\n", entry->virtual ); + + for ( i = entry->handle, j = 0 ; j < pages ; i += PAGE_SIZE, j++ ) { + pgd = pgd_offset_k( i ); + if ( !pgd_present( *pgd ) ) + goto failed; + + pmd = pmd_offset( pgd, i ); + if ( !pmd_present( *pmd ) ) + goto failed; + + pte = pte_offset( pmd, i ); + if ( !pte_present( *pte ) ) + goto failed; + + entry->pagelist[j] = pte_page( *pte ); + + SetPageReserved( entry->pagelist[j] ); + } + + request.handle = entry->handle; + + if ( copy_to_user( (drm_scatter_gather_t *)arg, + &request, + sizeof(request) ) ) { + DRM(sg_cleanup)( entry ); + return -EFAULT; + } + + dev->sg = entry; + +#if DEBUG_SCATTER + /* Verify that each page points to its virtual address, and vice + * versa. + */ + { + int error = 0; + + for ( i = 0 ; i < pages ; i++ ) { + unsigned long *tmp; + + tmp = (unsigned long *)entry->pagelist[i]->virtual; + for ( j = 0 ; + j < PAGE_SIZE / sizeof(unsigned long) ; + j++, tmp++ ) { + *tmp = 0xcafebabe; + } + tmp = (unsigned long *)((u8 *)entry->virtual + + (PAGE_SIZE * i)); + for( j = 0 ; + j < PAGE_SIZE / sizeof(unsigned long) ; + j++, tmp++ ) { + if ( *tmp != 0xcafebabe && error == 0 ) { + error = 1; + DRM_ERROR( "Scatter allocation error, " + "pagelist does not match " + "virtual mapping\n" ); + } + } + tmp = (unsigned long *)entry->pagelist[i]->virtual; + for(j = 0 ; + j < PAGE_SIZE / sizeof(unsigned long) ; + j++, tmp++) { + *tmp = 0; + } + } + if (error == 0) + DRM_ERROR( "Scatter allocation matches pagelist\n" ); + } +#endif + + return 0; + + failed: + DRM(sg_cleanup)( entry ); + return -ENOMEM; +} + +int DRM(sg_free)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_scatter_gather_t request; + drm_sg_mem_t *entry; + + if ( copy_from_user( &request, + (drm_scatter_gather_t *)arg, + sizeof(request) ) ) + return -EFAULT; + + entry = dev->sg; + dev->sg = NULL; + + if ( !entry || entry->handle != request.handle ) + return -EINVAL; + + DRM_DEBUG( "sg free virtual = %p\n", entry->virtual ); + + DRM(sg_cleanup)( entry ); + + return 0; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h index fb51926ba..771c11bd2 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h @@ -50,6 +50,12 @@ struct vm_operations_struct drm_vm_dma_ops = { close: DRM(vm_close), }; +struct vm_operations_struct drm_vm_sg_ops = { + nopage: DRM(vm_sg_nopage), + open: DRM(vm_open), + close: DRM(vm_close), +}; + #if LINUX_VERSION_CODE < 0x020317 unsigned long DRM(vm_nopage)(struct vm_area_struct *vma, unsigned long address, @@ -93,7 +99,7 @@ struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma, offset = address - vma->vm_start; i = (unsigned long)map->handle + offset; /* We have to walk page tables here because we need large SAREA's, and - * they need to be virtually contigious in kernel space. + * they need to be virtually contiguous in kernel space. */ pgd = pgd_offset_k( i ); if( !pgd_present( *pgd ) ) return NOPAGE_OOM; @@ -187,6 +193,7 @@ void DRM(vm_shm_close)(struct vm_area_struct *vma) vfree(map->handle); break; case _DRM_AGP: + case _DRM_SCATTER_GATHER: break; } DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); @@ -230,6 +237,48 @@ struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma, #endif } +#if LINUX_VERSION_CODE < 0x020317 +unsigned long DRM(vm_sg_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access) +#else + /* Return type changed in 2.3.23 */ +struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access) +#endif +{ +#if LINUX_VERSION_CODE >= 0x020300 + drm_map_t *map = (drm_map_t *)vma->vm_private_data; +#else + drm_map_t *map = (drm_map_t *)vma->vm_pte; +#endif + drm_file_t *priv = vma->vm_file->private_data; + drm_device_t *dev = priv->dev; + drm_sg_mem_t *entry = dev->sg; + unsigned long offset; + unsigned long map_offset; + unsigned long page_offset; + struct page *page; + + if (!entry) return NOPAGE_SIGBUS; /* Error */ + if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */ + if (!entry->pagelist) return NOPAGE_OOM ; /* Nothing allocated */ + + + offset = address - vma->vm_start; + map_offset = map->offset - dev->sg->handle; + page_offset = (offset >> PAGE_SHIFT) + (map_offset >> PAGE_SHIFT); + page = entry->pagelist[page_offset]; + atomic_inc(&page->count); /* Dec. by kernel */ + +#if LINUX_VERSION_CODE < 0x020317 + return (unsigned long)virt_to_phys(page->virtual); +#else + return page; +#endif +} + void DRM(vm_open)(struct vm_area_struct *vma) { drm_file_t *priv = vma->vm_file->private_data; @@ -322,6 +371,7 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma) drm_device_t *dev = priv->dev; drm_map_t *map = NULL; drm_map_list_t *r_list; + unsigned long offset = 0; struct list_head *list; DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n", @@ -374,19 +424,26 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma) } #elif defined(__ia64__) if (map->type != _DRM_AGP) - vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); + vma->vm_page_prot = + pgprot_writecombine(vma->vm_page_prot); +#elif defined(__powerpc__) + pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE | _PAGE_GUARDED; #endif vma->vm_flags |= VM_IO; /* not in core dump */ } +#ifdef __alpha__ + offset = dev->hose->dense_mem_base - + dev->hose->mem_space->start; +#endif if (remap_page_range(vma->vm_start, - VM_OFFSET(vma), + VM_OFFSET(vma) + offset, vma->vm_end - vma->vm_start, vma->vm_page_prot)) return -EAGAIN; DRM_DEBUG(" Type = %d; start = 0x%lx, end = 0x%lx," " offset = 0x%lx\n", map->type, - vma->vm_start, vma->vm_end, VM_OFFSET(vma)); + vma->vm_start, vma->vm_end, VM_OFFSET(vma) + offset); vma->vm_ops = &drm_vm_ops; break; case _DRM_SHM: @@ -400,6 +457,15 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma) DRM_KERNEL advisory is supported. */ vma->vm_flags |= VM_LOCKED; break; + case _DRM_SCATTER_GATHER: + vma->vm_ops = &drm_vm_sg_ops; +#if LINUX_VERSION_CODE >= 0x020300 + vma->vm_private_data = (void *)map; +#else + vma->vm_pte = (unsigned long)map; +#endif + vma->vm_flags |= VM_LOCKED; + break; default: return -EINVAL; /* This should never happen. */ } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c index 8b0a67a2d..66c9df9f6 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c @@ -42,6 +42,7 @@ #include <linux/delay.h> #define MGA_DEFAULT_USEC_TIMEOUT 10000 +#define MGA_FREELIST_DEBUG 0 /* ================================================================ @@ -63,7 +64,10 @@ int mga_do_wait_for_idle( drm_mga_private_t *dev_priv ) udelay( 1 ); } - DRM_DEBUG( "failed! status=0x%08x\n", status ); +#if MGA_DMA_DEBUG + DRM_ERROR( "failed!\n" ); + DRM_INFO( " status=0x%08x\n", status ); +#endif return -EBUSY; } @@ -79,7 +83,9 @@ int mga_do_dma_idle( drm_mga_private_t *dev_priv ) udelay( 1 ); } - DRM_DEBUG( "failed! status=0x%08x\n", status ); +#if MGA_DMA_DEBUG + DRM_ERROR( "failed! status=0x%08x\n", status ); +#endif return -EBUSY; } @@ -208,7 +214,7 @@ void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv ) DMA_BLOCK( MGA_DMAPAD, 0x00000000, MGA_DMAPAD, 0x00000000, MGA_DMAPAD, 0x00000000, - MGA_DWGSYNC, 0x12345678 ); + MGA_DMAPAD, 0x00000000 ); ADVANCE_DMA(); @@ -235,11 +241,13 @@ void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv ) mga_flush_write_combine(); MGA_WRITE( MGA_PRIMEND, tail | MGA_PAGPXFER ); + set_bit( 0, &primary->wrapped ); DRM_DEBUG( "%s: done.\n", __FUNCTION__ ); } void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv ) { + drm_mga_primary_buffer_t *primary = &dev_priv->prim; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; u32 head = dev_priv->primary->offset; DRM_DEBUG( "%s:\n", __FUNCTION__ ); @@ -250,6 +258,7 @@ void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv ) mga_flush_write_combine(); MGA_WRITE( MGA_PRIMADDRESS, head | MGA_DMA_GENERAL ); + clear_bit( 0, &primary->wrapped ); DRM_DEBUG( "%s: done.\n", __FUNCTION__ ); } @@ -261,6 +270,7 @@ void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv ) #define MGA_BUFFER_USED ~0 #define MGA_BUFFER_FREE 0 +#if MGA_FREELIST_DEBUG static void mga_freelist_print( drm_device_t *dev ) { drm_mga_private_t *dev_priv = dev->dev_private; @@ -280,6 +290,7 @@ static void mga_freelist_print( drm_device_t *dev ) } DRM_INFO( "\n" ); } +#endif static int mga_freelist_init( drm_device_t *dev ) { @@ -348,6 +359,9 @@ static void mga_freelist_cleanup( drm_device_t *dev ) dev_priv->head = dev_priv->tail = NULL; } +#if 0 +/* FIXME: Still needed? + */ static void mga_freelist_reset( drm_device_t *dev ) { drm_device_dma_t *dma = dev->dma; @@ -362,6 +376,7 @@ static void mga_freelist_reset( drm_device_t *dev ) MGA_BUFFER_FREE, 0 ); } } +#endif static drm_buf_t *mga_freelist_get( drm_device_t *dev ) { @@ -468,6 +483,11 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init ) dev_priv->depth_offset = init->depth_offset; dev_priv->depth_pitch = init->depth_pitch; + /* FIXME: Need to support AGP textures... + */ + dev_priv->texture_offset = init->texture_offset[0]; + dev_priv->texture_size = init->texture_size[0]; + list_for_each( list, &dev->maplist->head ) { drm_map_list_t *entry = (drm_map_list_t *)list; if ( entry->map && @@ -530,6 +550,7 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init ) dev_priv->prim.tail = 0; dev_priv->prim.space = dev_priv->prim.size; + dev_priv->prim.wrapped = 0; dev_priv->prim.last_flush = 0; dev_priv->prim.last_wrap = 0; @@ -621,15 +642,21 @@ int mga_dma_flush( struct inode *inode, struct file *filp, (lock.flags & _DRM_LOCK_FLUSH_ALL) ? "flush all, " : "", (lock.flags & _DRM_LOCK_QUIESCENT) ? "idle, " : "" ); - WRAP_TEST_WITH_RETURN( dev_priv ); + WRAP_WAIT_WITH_RETURN( dev_priv ); -#if 0 if ( lock.flags & (_DRM_LOCK_FLUSH | _DRM_LOCK_FLUSH_ALL) ) { mga_do_dma_flush( dev_priv ); } -#endif + if ( lock.flags & _DRM_LOCK_QUIESCENT ) { +#if MGA_DMA_DEBUG + int ret = mga_do_wait_for_idle( dev_priv ); + if ( ret < 0 ) + DRM_INFO( __FUNCTION__": -EBUSY\n" ); + return ret; +#else return mga_do_wait_for_idle( dev_priv ); +#endif } else { return 0; } @@ -681,6 +708,7 @@ int mga_dma_buffers( struct inode *inode, struct file *filp, drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; drm_device_dma_t *dma = dev->dma; + drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; drm_dma_t d; int ret = 0; @@ -705,6 +733,8 @@ int mga_dma_buffers( struct inode *inode, struct file *filp, return -EINVAL; } + WRAP_TEST_WITH_RETURN( dev_priv ); + d.granted_count = 0; if ( d.request_count ) { diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h index 066b4e480..4af2ca2e8 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h @@ -237,7 +237,7 @@ typedef struct drm_mga_init { MGA_CLEANUP_DMA = 0x02 } func; - int sarea_priv_offset; + unsigned long sarea_priv_offset; int chipset; int sgram; @@ -254,12 +254,12 @@ typedef struct drm_mga_init { unsigned int texture_offset[MGA_NR_TEX_HEAPS]; unsigned int texture_size[MGA_NR_TEX_HEAPS]; - unsigned int fb_offset; - unsigned int mmio_offset; - unsigned int status_offset; - unsigned int warp_offset; - unsigned int primary_offset; - unsigned int buffers_offset; + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long status_offset; + unsigned long warp_offset; + unsigned long primary_offset; + unsigned long buffers_offset; } drm_mga_init_t; typedef struct drm_mga_fullscreen { diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c index 42794e829..bea65cfa6 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c @@ -38,11 +38,11 @@ #define DRIVER_NAME "mga" #define DRIVER_DESC "Matrox G200/G400" -#define DRIVER_DATE "20010319" +#define DRIVER_DATE "20010321" #define DRIVER_MAJOR 3 #define DRIVER_MINOR 0 -#define DRIVER_PATCHLEVEL 1 +#define DRIVER_PATCHLEVEL 2 #define DRIVER_IOCTLS \ [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { mga_dma_buffers, 1, 0 }, \ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h index bd33d9d1e..bc70d7505 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h @@ -38,6 +38,7 @@ typedef struct drm_mga_primary_buffer { u32 tail; int space; + volatile int wrapped; volatile u32 *status; @@ -123,7 +124,6 @@ extern void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv ); extern int mga_freelist_put( drm_device_t *dev, drm_buf_t *buf ); - /* mga_state.c */ extern int mga_dma_clear( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); @@ -193,10 +193,26 @@ do { \ #define WRAP_TEST_WITH_RETURN( dev_priv ) \ do { \ - if ( dev_priv->sarea_priv->last_wrap < \ - dev_priv->prim.last_wrap ) { \ - if ( mga_do_wait_for_idle( dev_priv ) < 0 ) \ + if ( test_bit( 0, &dev_priv->prim.wrapped ) ) { \ + if ( mga_is_idle( dev_priv ) ) { \ + mga_do_dma_wrap_end( dev_priv ); \ + } else if ( dev_priv->prim.space < \ + dev_priv->prim.high_mark ) { \ + if ( MGA_DMA_DEBUG ) \ + DRM_INFO( __FUNCTION__": wrap...\n" ); \ + return -EBUSY; \ + } \ + } \ +} while (0) + +#define WRAP_WAIT_WITH_RETURN( dev_priv ) \ +do { \ + if ( test_bit( 0, &dev_priv->prim.wrapped ) ) { \ + if ( mga_do_wait_for_idle( dev_priv ) < 0 ) { \ + if ( MGA_DMA_DEBUG ) \ + DRM_INFO( __FUNCTION__": wrap...\n" ); \ return -EBUSY; \ + } \ mga_do_dma_wrap_end( dev_priv ); \ } \ } while (0) @@ -252,10 +268,13 @@ do { \ MGA_READ( MGA_PRIMADDRESS ) - \ dev_priv->primary->offset ); \ } \ - if ( dev_priv->prim.space < dev_priv->prim.high_mark ) { \ - mga_do_dma_wrap_start( dev_priv ); \ - } else { \ - mga_do_dma_flush( dev_priv ); \ + if ( !test_bit( 0, &dev_priv->prim.wrapped ) ) { \ + if ( dev_priv->prim.space < \ + dev_priv->prim.high_mark ) { \ + mga_do_dma_wrap_start( dev_priv ); \ + } else { \ + mga_do_dma_flush( dev_priv ); \ + } \ } \ } while (0) @@ -317,7 +336,7 @@ do { \ #define MGA_DMA_IDLE_MASK (MGA_SOFTRAPEN | \ MGA_ENDPRDMASTS) -#define MGA_DMA_SOFTRAP_SIZE 32 * DMA_BLOCK_SIZE +#define MGA_DMA_DEBUG 0 @@ -599,4 +618,12 @@ do { \ MGA_BLTMOD_BFCOL | \ MGA_CLIPDIS) +/* Simple idle test. + */ +static inline int mga_is_idle( drm_mga_private_t *dev_priv ) +{ + u32 status = MGA_READ( MGA_STATUS ) & MGA_ENGINE_IDLE_MASK; + return ( status == MGA_ENDPRDMASTS ); +} + #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c index 4c9c9c058..99778c581 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c @@ -408,7 +408,7 @@ static int mga_verify_context( drm_mga_private_t *dev_priv ) if ( ctx->dstorg != dev_priv->front_offset && ctx->dstorg != dev_priv->back_offset ) { - DRM_DEBUG( "*** bad DSTORG: %x (front %x, back %x)\n\n", + DRM_ERROR( "*** bad DSTORG: %x (front %x, back %x)\n\n", ctx->dstorg, dev_priv->front_offset, dev_priv->back_offset ); ctx->dstorg = 0; @@ -429,7 +429,7 @@ static int mga_verify_tex( drm_mga_private_t *dev_priv, int unit ) org = tex->texorg & (MGA_TEXORGMAP_MASK | MGA_TEXORGACC_MASK); if ( org == (MGA_TEXORGMAP_SYSMEM | MGA_TEXORGACC_PCI) ) { - DRM_DEBUG( "*** bad TEXORG: 0x%x, unit %d\n", + DRM_ERROR( "*** bad TEXORG: 0x%x, unit %d\n", tex->texorg, unit ); tex->texorg = 0; return -EINVAL; @@ -473,10 +473,13 @@ static int mga_verify_iload( drm_mga_private_t *dev_priv, if ( dstorg < dev_priv->texture_offset || dstorg + length > (dev_priv->texture_offset + dev_priv->texture_size) ) { + DRM_ERROR( "*** bad iload DSTORG: 0x%x\n", dstorg ); return -EINVAL; } if ( length & MGA_ILOAD_MASK ) { + DRM_ERROR( "*** bad iload length: 0x%x\n", + length & MGA_ILOAD_MASK ); return -EINVAL; } @@ -488,6 +491,8 @@ static int mga_verify_blit( drm_mga_private_t *dev_priv, { if ( (srcorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) || (dstorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) ) { + DRM_ERROR( "*** bad blit: src=0x%x dst=0x%x\n", + srcorg, dstorg ); return -EINVAL; } return 0; @@ -510,6 +515,15 @@ static void mga_dma_dispatch_clear( drm_device_t *dev, DMA_LOCALS; DRM_DEBUG( __FUNCTION__ ":\n" ); + BEGIN_DMA( 1 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DWGSYNC, 0x00007100, + MGA_DWGSYNC, 0x00007000 ); + + ADVANCE_DMA(); + for ( i = 0 ; i < nbox ; i++ ) { drm_clip_rect_t *box = &pbox[i]; u32 height = box->y2 - box->y1; @@ -752,7 +766,12 @@ static void mga_dma_dispatch_iload( drm_device_t *dev, drm_buf_t *buf, y2 = length / 64; - BEGIN_DMA( 4 ); + BEGIN_DMA( 5 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DWGSYNC, 0x00007100, + MGA_DWGSYNC, 0x00007000 ); DMA_BLOCK( MGA_DSTORG, dstorg, MGA_MACCESS, 0x00000000, @@ -1004,20 +1023,21 @@ int mga_dma_iload( struct inode *inode, struct file *filp, if ( copy_from_user( &iload, (drm_mga_iload_t *)arg, sizeof(iload) ) ) return -EFAULT; - if ( mga_do_wait_for_idle( dev_priv ) < 0 ) +#if 0 + if ( mga_do_wait_for_idle( dev_priv ) < 0 ) { + if ( MGA_DMA_DEBUG ) + DRM_INFO( __FUNCTION__": -EBUSY\n" ); return -EBUSY; + } +#endif buf = dma->buflist[iload.idx]; buf_priv = buf->dev_private; -#if 0 - DRM_INFO( " verifying iload...\n" ); if ( mga_verify_iload( dev_priv, iload.dstorg, iload.length ) ) { mga_freelist_put( dev, buf ); return -EINVAL; } - DRM_INFO( " verifying iload... done.\n" ); -#endif WRAP_TEST_WITH_RETURN( dev_priv ); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h index 83e002afa..926b4bfd2 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h @@ -37,9 +37,11 @@ /* General customization: */ #define __HAVE_AGP 1 -#define __MUST_HAVE_AGP 1 +#define __MUST_HAVE_AGP 0 #define __HAVE_MTRR 1 #define __HAVE_CTX_BITMAP 1 +#define __HAVE_SG 1 +#define __HAVE_PCI_DMA 1 /* Driver customization: */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c index c0e20c213..1ced05fe9 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c @@ -178,6 +178,8 @@ static void r128_cce_load_microcode( drm_r128_private_t *dev_priv ) { int i; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + r128_do_wait_for_idle( dev_priv ); R128_WRITE( R128_PM4_MICROCODE_ADDR, 0 ); @@ -208,7 +210,7 @@ int r128_do_cce_idle( drm_r128_private_t *dev_priv ) int i; for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - if ( *dev_priv->ring.head == dev_priv->ring.tail ) { + if ( GET_RING_HEAD( &dev_priv->ring ) == dev_priv->ring.tail ) { int pm4stat = R128_READ( R128_PM4_STAT ); if ( ( (pm4stat & R128_PM4_FIFOCNT_MASK) >= dev_priv->cce_fifo_size ) && @@ -249,7 +251,7 @@ static void r128_do_cce_reset( drm_r128_private_t *dev_priv ) { R128_WRITE( R128_PM4_BUFFER_DL_WPTR, 0 ); R128_WRITE( R128_PM4_BUFFER_DL_RPTR, 0 ); - *dev_priv->ring.head = 0; + SET_RING_HEAD( &dev_priv->ring, 0 ); dev_priv->ring.tail = 0; } @@ -312,19 +314,43 @@ static void r128_cce_init_ring_buffer( drm_device_t *dev ) u32 ring_start; u32 tmp; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + /* The manual (p. 2) says this address is in "VM space". This * means it's an offset from the start of AGP space. */ - ring_start = dev_priv->cce_ring->offset - dev->agp->base; +#if __REALLY_HAVE_AGP + if ( !dev_priv->is_pci ) + ring_start = dev_priv->cce_ring->offset - dev->agp->base; + else +#endif + ring_start = dev_priv->cce_ring->offset - dev->sg->handle; + R128_WRITE( R128_PM4_BUFFER_OFFSET, ring_start | R128_AGP_OFFSET ); R128_WRITE( R128_PM4_BUFFER_DL_WPTR, 0 ); R128_WRITE( R128_PM4_BUFFER_DL_RPTR, 0 ); /* DL_RPTR_ADDR is a physical address in AGP space. */ - *dev_priv->ring.head = 0; - R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR, - dev_priv->ring_rptr->offset ); + SET_RING_HEAD( &dev_priv->ring, 0 ); + + if ( !dev_priv->is_pci ) { + R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR, + dev_priv->ring_rptr->offset ); + } else { + drm_sg_mem_t *entry = dev->sg; + unsigned long tmp_ofs, page_ofs; + + tmp_ofs = dev_priv->ring_rptr->offset - dev->sg->handle; + page_ofs = tmp_ofs >> PAGE_SHIFT; + + R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR, + virt_to_bus(entry->pagelist[page_ofs]->virtual)); + + DRM_DEBUG( "ring rptr: offset=0x%08lx handle=0x%08lx\n", + virt_to_bus(entry->pagelist[page_ofs]->virtual), + entry->handle + tmp_ofs ); + } /* Set watermark control */ R128_WRITE( R128_PM4_BUFFER_WM_CNTL, @@ -346,6 +372,8 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) drm_r128_private_t *dev_priv; struct list_head *list; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + dev_priv = DRM(alloc)( sizeof(drm_r128_private_t), DRM_MEM_DRIVER ); if ( dev_priv == NULL ) return -ENOMEM; @@ -355,11 +383,9 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) dev_priv->is_pci = init->is_pci; - /* GH: We don't support PCI cards until PCI GART is implemented. - * Fail here so we can remove all checks for PCI cards around - * the CCE ring code. - */ - if ( dev_priv->is_pci ) { + if ( dev_priv->is_pci && !dev->sg ) { + DRM_DEBUG( "PCI GART memory not allocated!\n" ); + DRM_ERROR( "PCI GART memory not allocated!\n" ); DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); dev->dev_private = NULL; return -EINVAL; @@ -368,6 +394,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) dev_priv->usec_timeout = init->usec_timeout; if ( dev_priv->usec_timeout < 1 || dev_priv->usec_timeout > R128_MAX_USEC_TIMEOUT ) { + DRM_DEBUG( "TIMEOUT problem!\n" ); DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); dev->dev_private = NULL; return -EINVAL; @@ -387,6 +414,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) ( init->cce_mode != R128_PM4_128BM_64INDBM ) && ( init->cce_mode != R128_PM4_64BM_128INDBM ) && ( init->cce_mode != R128_PM4_64BM_64VCBM_64INDBM ) ) { + DRM_DEBUG( "Bad cce_mode!\n" ); DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); dev->dev_private = NULL; return -EINVAL; @@ -476,9 +504,24 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) (drm_r128_sarea_t *)((u8 *)dev_priv->sarea->handle + init->sarea_priv_offset); - DRM_IOREMAP( dev_priv->cce_ring ); - DRM_IOREMAP( dev_priv->ring_rptr ); - DRM_IOREMAP( dev_priv->buffers ); + if ( !dev_priv->is_pci ) { + DRM_IOREMAP( dev_priv->cce_ring ); + DRM_IOREMAP( dev_priv->ring_rptr ); + DRM_IOREMAP( dev_priv->buffers ); + } else { + dev_priv->cce_ring->handle = + (void *)dev_priv->cce_ring->offset; + dev_priv->ring_rptr->handle = + (void *)dev_priv->ring_rptr->offset; + dev_priv->buffers->handle = (void *)dev_priv->buffers->offset; + } + +#if __REALLY_HAVE_AGP + if ( !dev_priv->is_pci ) + dev_priv->cce_buffers_offset = dev->agp->base; + else +#endif + dev_priv->cce_buffers_offset = dev->sg->handle; dev_priv->ring.head = ((__volatile__ u32 *) dev_priv->ring_rptr->handle); @@ -501,6 +544,20 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) R128_WRITE( R128_LAST_DISPATCH_REG, dev_priv->sarea_priv->last_dispatch ); + if ( dev_priv->is_pci ) { + dev_priv->phys_pci_gart = DRM(ati_pcigart_init)( dev ); + if ( !dev_priv->phys_pci_gart ) { + DRM_DEBUG( "failed to init PCI GART!\n" ); + DRM_ERROR( "failed to init PCI GART!\n" ); + DRM(free)( dev_priv, sizeof(*dev_priv), + DRM_MEM_DRIVER ); + dev->dev_private = NULL; + return -EINVAL; + } + R128_WRITE( R128_PCI_GART_PAGE, + virt_to_bus( (void *)dev_priv->phys_pci_gart ) ); + } + r128_cce_init_ring_buffer( dev ); r128_cce_load_microcode( dev_priv ); r128_do_engine_reset( dev ); @@ -513,9 +570,11 @@ int r128_do_cleanup_cce( drm_device_t *dev ) if ( dev->dev_private ) { drm_r128_private_t *dev_priv = dev->dev_private; - DRM_IOREMAPFREE( dev_priv->cce_ring ); - DRM_IOREMAPFREE( dev_priv->ring_rptr ); - DRM_IOREMAPFREE( dev_priv->buffers ); + if ( !dev_priv->is_pci ) { + DRM_IOREMAPFREE( dev_priv->cce_ring ); + DRM_IOREMAPFREE( dev_priv->ring_rptr ); + DRM_IOREMAPFREE( dev_priv->buffers ); + } DRM(free)( dev->dev_private, sizeof(drm_r128_private_t), DRM_MEM_DRIVER ); @@ -532,6 +591,8 @@ int r128_cce_init( struct inode *inode, struct file *filp, drm_device_t *dev = priv->dev; drm_r128_init_t init; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + if ( copy_from_user( &init, (drm_r128_init_t *)arg, sizeof(init) ) ) return -EFAULT; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h index 86aba175f..fc1261eae 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h @@ -175,7 +175,7 @@ typedef struct drm_r128_init { R128_INIT_CCE = 0x01, R128_CLEANUP_CCE = 0x02 } func; - int sarea_priv_offset; + unsigned long sarea_priv_offset; int is_pci; int cce_mode; int cce_secure; @@ -189,12 +189,12 @@ typedef struct drm_r128_init { unsigned int depth_offset, depth_pitch; unsigned int span_offset; - unsigned int fb_offset; - unsigned int mmio_offset; - unsigned int ring_offset; - unsigned int ring_rptr_offset; - unsigned int buffers_offset; - unsigned int agp_textures_offset; + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long ring_offset; + unsigned long ring_rptr_offset; + unsigned long buffers_offset; + unsigned long agp_textures_offset; } drm_r128_init_t; typedef struct drm_r128_cce_stop { diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c index daae0f875..584cb29c3 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c @@ -33,16 +33,17 @@ #include "r128.h" #include "drmP.h" #include "r128_drv.h" +#include "ati_pcigart.h" #define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." #define DRIVER_NAME "r128" #define DRIVER_DESC "ATI Rage 128" -#define DRIVER_DATE "20010308" +#define DRIVER_DATE "20010405" #define DRIVER_MAJOR 2 #define DRIVER_MINOR 1 -#define DRIVER_PATCHLEVEL 5 +#define DRIVER_PATCHLEVEL 6 #define DRIVER_IOCTLS \ [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { r128_cce_buffers, 1, 0 }, \ @@ -88,3 +89,4 @@ #include "drm_proc.h" #include "drm_vm.h" #include "drm_stub.h" +#include "drm_scatter.h" diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h index 6216b9a1b..0ef94e454 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h @@ -28,11 +28,15 @@ * Rickard E. (Rik) Faith <faith@valinux.com> * Kevin E. Martin <martin@valinux.com> * Gareth Hughes <gareth@valinux.com> + * Michel Dänzer <daenzerm@student.ethz.ch> */ #ifndef __R128_DRV_H__ #define __R128_DRV_H__ +#define GET_RING_HEAD( ring ) le32_to_cpu( *(ring)->head ) +#define SET_RING_HEAD( ring, val ) *(ring)->head = cpu_to_le32( val ) + typedef struct drm_r128_freelist { unsigned int age; drm_buf_t *buf; @@ -67,6 +71,8 @@ typedef struct drm_r128_private { int usec_timeout; int is_pci; + unsigned long phys_pci_gart; + unsigned long cce_buffers_offset; atomic_t idle_count; @@ -134,7 +140,7 @@ extern int r128_wait_ring( drm_r128_private_t *dev_priv, int n ); static inline void r128_update_ring_snapshot( drm_r128_ring_buffer_t *ring ) { - ring->space = (*(volatile int *)ring->head - ring->tail) * sizeof(u32); + ring->space = (GET_RING_HEAD( ring ) - ring->tail) * sizeof(u32); if ( ring->space <= 0 ) ring->space += ring->size; } @@ -248,6 +254,7 @@ extern int r128_cce_indirect( struct inode *inode, struct file *filp, # define R128_PC_FLUSH_ALL 0x00ff # define R128_PC_BUSY (1 << 31) +#define R128_PCI_GART_PAGE 0x017c #define R128_PRIM_TEX_CNTL_C 0x1cb0 #define R128_SCALE_3D_CNTL 0x1a00 @@ -365,7 +372,7 @@ extern int r128_cce_indirect( struct inode *inode, struct file *filp, #define R128_LAST_FRAME_REG R128_GUI_SCRATCH_REG0 #define R128_LAST_DISPATCH_REG R128_GUI_SCRATCH_REG1 -#define R128_MAX_VB_AGE 0xffffffff +#define R128_MAX_VB_AGE 0x7fffffff #define R128_MAX_VB_VERTS (0xffff) #define R128_RING_HIGH_MARK 128 @@ -373,22 +380,53 @@ extern int r128_cce_indirect( struct inode *inode, struct file *filp, #define R128_PERFORMANCE_BOXES 0 -#define R128_BASE(reg) ((u32)(dev_priv->mmio->handle)) +#define R128_BASE(reg) ((unsigned long)(dev_priv->mmio->handle)) #define R128_ADDR(reg) (R128_BASE( reg ) + reg) #define R128_DEREF(reg) *(volatile u32 *)R128_ADDR( reg ) -#define R128_READ(reg) R128_DEREF( reg ) -#define R128_WRITE(reg,val) do { R128_DEREF( reg ) = val; } while (0) +#ifdef __alpha__ +#define R128_READ(reg) (_R128_READ((u32 *)R128_ADDR(reg))) +static inline u32 _R128_READ(u32 *addr) +{ + mb(); + return *(volatile u32 *)addr; +} +#define R128_WRITE(reg,val) \ +do { \ + wmb(); \ + R128_DEREF(reg) = val; \ +} while (0) +#else +#define R128_READ(reg) le32_to_cpu( R128_DEREF( reg ) ) +#define R128_WRITE(reg,val) \ +do { \ + R128_DEREF( reg ) = cpu_to_le32( val ); \ +} while (0) +#endif #define R128_DEREF8(reg) *(volatile u8 *)R128_ADDR( reg ) +#ifdef __alpha__ +#define R128_READ8(reg) _R128_READ8((u8 *)R128_ADDR(reg)) +static inline u8 _R128_READ8(u8 *addr) +{ + mb(); + return *(volatile u8 *)addr; +} +#define R128_WRITE8(reg,val) \ +do { \ + wmb(); \ + R128_DEREF8(reg) = val; \ +} while (0) +#else #define R128_READ8(reg) R128_DEREF8( reg ) #define R128_WRITE8(reg,val) do { R128_DEREF8( reg ) = val; } while (0) +#endif - -#define R128_WRITE_PLL(addr,val) \ -do { \ - R128_WRITE8(R128_CLOCK_CNTL_INDEX, ((addr) & 0x1f) | R128_PLL_WR_EN); \ - R128_WRITE(R128_CLOCK_CNTL_DATA, (val)); \ +#define R128_WRITE_PLL(addr,val) \ +do { \ + R128_WRITE8(R128_CLOCK_CNTL_INDEX, \ + ((addr) & 0x1f) | R128_PLL_WR_EN); \ + R128_WRITE(R128_CLOCK_CNTL_DATA, (val)); \ } while (0) extern int R128_READ_PLL(drm_device_t *dev, int addr); @@ -485,7 +523,7 @@ do { \ #define ADVANCE_RING() do { \ if ( R128_VERBOSE ) { \ - DRM_INFO( "ADVANCE_RING() tail=0x%06x wr=0x%06x\n", \ + DRM_INFO( "ADVANCE_RING() wr=0x%06x tail=0x%06x\n", \ write, dev_priv->ring.tail ); \ } \ if ( R128_BROKEN_CCE && write < 32 ) { \ @@ -503,7 +541,7 @@ do { \ DRM_INFO( " OUT_RING( 0x%08x ) at 0x%x\n", \ (unsigned int)(x), write ); \ } \ - ring[write++] = (x); \ + ring[write++] = cpu_to_le32( x ); \ write &= tail_mask; \ } while (0) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c index 9fc6b485c..7eafd72d6 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c @@ -660,7 +660,7 @@ static void r128_cce_dispatch_indirect( drm_device_t *dev, u32 *data = (u32 *) ((char *)dev_priv->buffers->handle + buf->offset + start); - data[dwords++] = R128_CCE_PACKET2; + data[dwords++] = cpu_to_le32( R128_CCE_PACKET2 ); } buf_priv->dispatched = 1; @@ -704,7 +704,7 @@ static void r128_cce_dispatch_indices( drm_device_t *dev, drm_r128_buf_priv_t *buf_priv = buf->dev_private; drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; int format = sarea_priv->vc_format; - int offset = dev_priv->buffers->offset - dev->agp->base; + int offset = dev_priv->buffers->offset - dev_priv->cce_buffers_offset; int prim = buf_priv->prim; u32 *data; int dwords; @@ -727,16 +727,21 @@ static void r128_cce_dispatch_indices( drm_device_t *dev, data = (u32 *)((char *)dev_priv->buffers->handle + buf->offset + start); - data[0] = CCE_PACKET3( R128_3D_RNDR_GEN_INDX_PRIM, dwords-2 ); + data[0] = cpu_to_le32( CCE_PACKET3( R128_3D_RNDR_GEN_INDX_PRIM, + dwords-2 ) ); - data[1] = offset; - data[2] = R128_MAX_VB_VERTS; - data[3] = format; - data[4] = (prim | R128_CCE_VC_CNTL_PRIM_WALK_IND | - (count << 16)); + data[1] = cpu_to_le32( offset ); + data[2] = cpu_to_le32( R128_MAX_VB_VERTS ); + data[3] = cpu_to_le32( format ); + data[4] = cpu_to_le32( (prim | R128_CCE_VC_CNTL_PRIM_WALK_IND | + (count << 16)) ); if ( count & 0x1 ) { +#ifdef __LITTLE_ENDIAN data[dwords-1] &= 0x0000ffff; +#else + data[dwords-1] &= 0xffff0000; +#endif } do { @@ -842,23 +847,23 @@ static int r128_cce_dispatch_blit( drm_device_t *dev, data = (u32 *)((char *)dev_priv->buffers->handle + buf->offset); - data[0] = CCE_PACKET3( R128_CNTL_HOSTDATA_BLT, dwords + 6 ); - data[1] = (R128_GMC_DST_PITCH_OFFSET_CNTL | - R128_GMC_BRUSH_NONE | - (blit->format << 8) | - R128_GMC_SRC_DATATYPE_COLOR | - R128_ROP3_S | - R128_DP_SRC_SOURCE_HOST_DATA | - R128_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS | - R128_GMC_WR_MSK_DIS); - - data[2] = (blit->pitch << 21) | (blit->offset >> 5); - data[3] = 0xffffffff; - data[4] = 0xffffffff; - data[5] = (blit->y << 16) | blit->x; - data[6] = (blit->height << 16) | blit->width; - data[7] = dwords; + data[0] = cpu_to_le32( CCE_PACKET3( R128_CNTL_HOSTDATA_BLT, dwords + 6 ) ); + data[1] = cpu_to_le32( (R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_NONE | + (blit->format << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_S | + R128_DP_SRC_SOURCE_HOST_DATA | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_AUX_CLIP_DIS | + R128_GMC_WR_MSK_DIS) ); + + data[2] = cpu_to_le32( (blit->pitch << 21) | (blit->offset >> 5) ); + data[3] = cpu_to_le32( 0xffffffff ); + data[4] = cpu_to_le32( 0xffffffff ); + data[5] = cpu_to_le32( (blit->y << 16) | blit->x ); + data[6] = cpu_to_le32( (blit->height << 16) | blit->width ); + data[7] = cpu_to_le32( dwords ); buf->used = (dwords + 8) * sizeof(u32); @@ -1299,8 +1304,8 @@ int r128_cce_vertex( struct inode *inode, struct file *filp, LOCK_TEST_WITH_RETURN( dev ); - if ( !dev_priv || dev_priv->is_pci ) { - DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ ); + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); return -EINVAL; } @@ -1362,8 +1367,8 @@ int r128_cce_indices( struct inode *inode, struct file *filp, LOCK_TEST_WITH_RETURN( dev ); - if ( !dev_priv || dev_priv->is_pci ) { - DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ ); + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); return -EINVAL; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h index db238b1b4..0fdeb82a8 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h @@ -37,9 +37,11 @@ /* General customization: */ #define __HAVE_AGP 1 -#define __MUST_HAVE_AGP 1 +#define __MUST_HAVE_AGP 0 #define __HAVE_MTRR 1 #define __HAVE_CTX_BITMAP 1 +#define __HAVE_SG 1 +#define __HAVE_PCI_DMA 1 /* Driver customization: */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c index ed8b1bbca..c255a3e05 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c @@ -318,6 +318,16 @@ static void radeon_status( drm_radeon_private_t *dev_priv ) (unsigned int)RADEON_READ( RADEON_CP_RB_RPTR ) ); printk( "CP_RB_WTPR = 0x%08x\n", (unsigned int)RADEON_READ( RADEON_CP_RB_WPTR ) ); + printk( "AIC_CNTL = 0x%08x\n", + (unsigned int)RADEON_READ( RADEON_AIC_CNTL ) ); + printk( "AIC_STAT = 0x%08x\n", + (unsigned int)RADEON_READ( RADEON_AIC_STAT ) ); + printk( "AIC_PT_BASE = 0x%08x\n", + (unsigned int)RADEON_READ( RADEON_AIC_PT_BASE ) ); + printk( "TLB_ADDR = 0x%08x\n", + (unsigned int)RADEON_READ( RADEON_AIC_TLB_ADDR ) ); + printk( "TLB_DATA = 0x%08x\n", + (unsigned int)RADEON_READ( RADEON_AIC_TLB_DATA ) ); } #endif @@ -401,6 +411,7 @@ static int radeon_do_wait_for_idle( drm_radeon_private_t *dev_priv ) static void radeon_cp_load_microcode( drm_radeon_private_t *dev_priv ) { int i; + DRM_DEBUG( "%s\n", __FUNCTION__ ); radeon_do_wait_for_idle( dev_priv ); @@ -419,6 +430,7 @@ static void radeon_cp_load_microcode( drm_radeon_private_t *dev_priv ) */ static void radeon_do_cp_flush( drm_radeon_private_t *dev_priv ) { + DRM_DEBUG( "%s\n", __FUNCTION__ ); #if 0 u32 tmp; @@ -432,6 +444,7 @@ static void radeon_do_cp_flush( drm_radeon_private_t *dev_priv ) int radeon_do_cp_idle( drm_radeon_private_t *dev_priv ) { RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); BEGIN_RING( 6 ); @@ -449,6 +462,7 @@ int radeon_do_cp_idle( drm_radeon_private_t *dev_priv ) static void radeon_do_cp_start( drm_radeon_private_t *dev_priv ) { RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); radeon_do_wait_for_idle( dev_priv ); @@ -472,6 +486,7 @@ static void radeon_do_cp_start( drm_radeon_private_t *dev_priv ) static void radeon_do_cp_reset( drm_radeon_private_t *dev_priv ) { u32 cur_read_ptr; + DRM_DEBUG( "%s\n", __FUNCTION__ ); cur_read_ptr = RADEON_READ( RADEON_CP_RB_RPTR ); RADEON_WRITE( RADEON_CP_RB_WPTR, cur_read_ptr ); @@ -485,6 +500,8 @@ static void radeon_do_cp_reset( drm_radeon_private_t *dev_priv ) */ static void radeon_do_cp_stop( drm_radeon_private_t *dev_priv ) { + DRM_DEBUG( "%s\n", __FUNCTION__ ); + RADEON_WRITE( RADEON_CP_CSQ_CNTL, RADEON_CSQ_PRIDIS_INDDIS ); dev_priv->cp_running = 0; @@ -551,18 +568,29 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev ) drm_radeon_private_t *dev_priv = dev->dev_private; u32 ring_start, cur_read_ptr; u32 tmp; + DRM_DEBUG( "%s\n", __FUNCTION__ ); /* Initialize the memory controller */ RADEON_WRITE( RADEON_MC_FB_LOCATION, (dev_priv->agp_vm_start - 1) & 0xffff0000 ); - RADEON_WRITE( RADEON_MC_AGP_LOCATION, - (((dev_priv->agp_vm_start - 1 + - dev_priv->agp_size) & 0xffff0000) | - (dev_priv->agp_vm_start >> 16)) ); - ring_start = (dev_priv->cp_ring->offset - - dev->agp->base - + dev_priv->agp_vm_start); + if ( !dev_priv->is_pci ) { + RADEON_WRITE( RADEON_MC_AGP_LOCATION, + (((dev_priv->agp_vm_start - 1 + + dev_priv->agp_size) & 0xffff0000) | + (dev_priv->agp_vm_start >> 16)) ); + } + +#if __REALLY_HAVE_AGP + if ( !dev_priv->is_pci ) + ring_start = (dev_priv->cp_ring->offset + - dev->agp->base + + dev_priv->agp_vm_start); + else +#endif + ring_start = (dev_priv->cp_ring->offset + - dev->sg->handle + + dev_priv->agp_vm_start); RADEON_WRITE( RADEON_CP_RB_BASE, ring_start ); @@ -575,17 +603,29 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev ) *dev_priv->ring.head = cur_read_ptr; dev_priv->ring.tail = cur_read_ptr; - RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR, dev_priv->ring_rptr->offset ); + if ( !dev_priv->is_pci ) { + RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR, + dev_priv->ring_rptr->offset ); + } else { + drm_sg_mem_t *entry = dev->sg; + unsigned long tmp_ofs, page_ofs; + + tmp_ofs = dev_priv->ring_rptr->offset - dev->sg->handle; + page_ofs = tmp_ofs >> PAGE_SHIFT; + + RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR, + virt_to_bus(entry->pagelist[page_ofs]->virtual)); + + DRM_DEBUG( "ring rptr: offset=0x%08lx handle=0x%08lx\n", + virt_to_bus(entry->pagelist[page_ofs]->virtual), + entry->handle + tmp_ofs ); + } /* Set ring buffer size */ RADEON_WRITE( RADEON_CP_RB_CNTL, dev_priv->ring.size_l2qw ); radeon_do_wait_for_idle( dev_priv ); - /* Turn off PCI GART */ - tmp = RADEON_READ( RADEON_AIC_CNTL ) & ~RADEON_PCIGART_TRANSLATE_EN; - RADEON_WRITE( RADEON_AIC_CNTL, tmp ); - /* Turn on bus mastering */ tmp = RADEON_READ( RADEON_BUS_CNTL ) & ~RADEON_BUS_MASTER_DIS; RADEON_WRITE( RADEON_BUS_CNTL, tmp ); @@ -602,6 +642,8 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) { drm_radeon_private_t *dev_priv; struct list_head *list; + u32 tmp; + DRM_DEBUG( "%s\n", __FUNCTION__ ); dev_priv = DRM(alloc)( sizeof(drm_radeon_private_t), DRM_MEM_DRIVER ); if ( dev_priv == NULL ) @@ -612,11 +654,20 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) dev_priv->is_pci = init->is_pci; - /* We don't support PCI cards until PCI GART is implemented. - * Fail here so we can remove all checks for PCI cards around - * the CP ring code. +#if 1 + /* PCI support is not 100% working, so we disable it here. */ if ( dev_priv->is_pci ) { + DRM_ERROR( "PCI GART not yet supported for Radeon!\n" ); + DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); + dev->dev_private = NULL; + return -EINVAL; + } +#endif + + if ( dev_priv->is_pci && !dev->sg ) { + DRM_DEBUG( "PCI GART memory not allocated!\n" ); + DRM_ERROR( "PCI GART memory not allocated!\n" ); DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); dev->dev_private = NULL; return -EINVAL; @@ -625,6 +676,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) dev_priv->usec_timeout = init->usec_timeout; if ( dev_priv->usec_timeout < 1 || dev_priv->usec_timeout > RADEON_MAX_USEC_TIMEOUT ) { + DRM_DEBUG( "TIMEOUT problem!\n" ); DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); dev->dev_private = NULL; return -EINVAL; @@ -642,6 +694,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) */ if ( ( init->cp_mode != RADEON_CSQ_PRIBM_INDDIS ) && ( init->cp_mode != RADEON_CSQ_PRIBM_INDBM ) ) { + DRM_DEBUG( "BAD cp_mode (%x)!\n", init->cp_mode ); DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); dev->dev_private = NULL; return -EINVAL; @@ -735,15 +788,45 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) (drm_radeon_sarea_t *)((u8 *)dev_priv->sarea->handle + init->sarea_priv_offset); - DRM_IOREMAP( dev_priv->cp_ring ); - DRM_IOREMAP( dev_priv->ring_rptr ); - DRM_IOREMAP( dev_priv->buffers ); + if ( !dev_priv->is_pci ) { + DRM_IOREMAP( dev_priv->cp_ring ); + DRM_IOREMAP( dev_priv->ring_rptr ); + DRM_IOREMAP( dev_priv->buffers ); + } else { + dev_priv->cp_ring->handle = + (void *)dev_priv->cp_ring->offset; + dev_priv->ring_rptr->handle = + (void *)dev_priv->ring_rptr->offset; + dev_priv->buffers->handle = (void *)dev_priv->buffers->offset; + + DRM_DEBUG( "dev_priv->cp_ring->handle %p\n", + dev_priv->cp_ring->handle ); + DRM_DEBUG( "dev_priv->ring_rptr->handle %p\n", + dev_priv->ring_rptr->handle ); + DRM_DEBUG( "dev_priv->buffers->handle %p\n", + dev_priv->buffers->handle ); + } + dev_priv->agp_size = init->agp_size; dev_priv->agp_vm_start = RADEON_READ( RADEON_CONFIG_APER_SIZE ); - dev_priv->agp_buffers_offset = (dev_priv->buffers->offset - - dev->agp->base - + dev_priv->agp_vm_start); +#if __REALLY_HAVE_AGP + if ( !dev_priv->is_pci ) + dev_priv->agp_buffers_offset = (dev_priv->buffers->offset + - dev->agp->base + + dev_priv->agp_vm_start); + else +#endif + dev_priv->agp_buffers_offset = (dev_priv->buffers->offset + - dev->sg->handle + + dev_priv->agp_vm_start); + + DRM_DEBUG( "dev_priv->agp_size %d\n", + dev_priv->agp_size ); + DRM_DEBUG( "dev_priv->agp_vm_start 0x%x\n", + dev_priv->agp_vm_start ); + DRM_DEBUG( "dev_priv->agp_buffers_offset 0x%lx\n", + dev_priv->agp_buffers_offset ); dev_priv->ring.head = ((__volatile__ u32 *) dev_priv->ring_rptr->handle); @@ -787,6 +870,44 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) RADEON_WRITE( RADEON_LAST_CLEAR_REG, dev_priv->sarea_priv->last_clear ); + if ( dev_priv->is_pci ) { + dev_priv->phys_pci_gart = DRM(ati_pcigart_init)( dev ); + if ( !dev_priv->phys_pci_gart ) { + DRM_DEBUG( "failed to init PCI GART!\n" ); + DRM_ERROR( "failed to init PCI GART!\n" ); + DRM(free)( dev_priv, sizeof(*dev_priv), + DRM_MEM_DRIVER ); + dev->dev_private = NULL; + return -EINVAL; + } + /* Turn on PCI GART + */ + tmp = RADEON_READ( RADEON_AIC_CNTL ) + | RADEON_PCIGART_TRANSLATE_EN; + RADEON_WRITE( RADEON_AIC_CNTL, tmp ); + + /* set PCI GART page-table base address + */ + RADEON_WRITE( RADEON_AIC_PT_BASE, + virt_to_bus( (void *)dev_priv->phys_pci_gart ) ); + + /* set address range for PCI address translate + */ + RADEON_WRITE( RADEON_AIC_LO_ADDR, dev_priv->agp_vm_start ); + RADEON_WRITE( RADEON_AIC_HI_ADDR, dev_priv->agp_vm_start + + dev_priv->agp_size - 1); + + /* Turn off AGP aperture -- is this required for PCIGART? + */ + RADEON_WRITE( RADEON_MC_AGP_LOCATION, 0 ); + } else { + /* Turn off PCI GART + */ + tmp = RADEON_READ( RADEON_AIC_CNTL ) + & ~RADEON_PCIGART_TRANSLATE_EN; + RADEON_WRITE( RADEON_AIC_CNTL, tmp ); + } + radeon_cp_load_microcode( dev_priv ); radeon_cp_init_ring_buffer( dev ); radeon_do_engine_reset( dev ); @@ -800,12 +921,16 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) int radeon_do_cleanup_cp( drm_device_t *dev ) { + DRM_DEBUG( "%s\n", __FUNCTION__ ); + if ( dev->dev_private ) { drm_radeon_private_t *dev_priv = dev->dev_private; - DRM_IOREMAPFREE( dev_priv->cp_ring ); - DRM_IOREMAPFREE( dev_priv->ring_rptr ); - DRM_IOREMAPFREE( dev_priv->buffers ); + if ( !dev_priv->is_pci ) { + DRM_IOREMAPFREE( dev_priv->cp_ring ); + DRM_IOREMAPFREE( dev_priv->ring_rptr ); + DRM_IOREMAPFREE( dev_priv->buffers ); + } DRM(free)( dev->dev_private, sizeof(drm_radeon_private_t), DRM_MEM_DRIVER ); @@ -1173,7 +1298,10 @@ int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n ) } /* FIXME: This return value is ignored in the BEGIN_RING macro! */ +#if RADEON_FIFO_DEBUG + radeon_status( dev_priv ); DRM_ERROR( "failed!\n" ); +#endif return -EBUSY; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h index 50a7d6ed8..4ae387ff0 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h @@ -236,7 +236,7 @@ typedef struct drm_radeon_init { RADEON_INIT_CP = 0x01, RADEON_CLEANUP_CP = 0x02 } func; - int sarea_priv_offset; + unsigned long sarea_priv_offset; int is_pci; int cp_mode; int agp_size; @@ -249,12 +249,12 @@ typedef struct drm_radeon_init { unsigned int depth_bpp; unsigned int depth_offset, depth_pitch; - unsigned int fb_offset; - unsigned int mmio_offset; - unsigned int ring_offset; - unsigned int ring_rptr_offset; - unsigned int buffers_offset; - unsigned int agp_textures_offset; + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long ring_offset; + unsigned long ring_rptr_offset; + unsigned long buffers_offset; + unsigned long agp_textures_offset; } drm_radeon_init_t; typedef struct drm_radeon_cp_stop { diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c index dba2037f9..d76326676 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c @@ -31,15 +31,16 @@ #include "radeon.h" #include "drmP.h" #include "radeon_drv.h" +#include "ati_pcigart.h" #define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." #define DRIVER_NAME "radeon" #define DRIVER_DESC "ATI Radeon" -#define DRIVER_DATE "20010308" +#define DRIVER_DATE "20010405" #define DRIVER_MAJOR 1 -#define DRIVER_MINOR 0 +#define DRIVER_MINOR 1 #define DRIVER_PATCHLEVEL 1 #define DRIVER_IOCTLS \ @@ -85,3 +86,4 @@ #include "drm_proc.h" #include "drm_vm.h" #include "drm_stub.h" +#include "drm_scatter.h" diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h index f176bb560..ee5e113b1 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h @@ -64,7 +64,7 @@ typedef struct drm_radeon_private { int agp_size; u32 agp_vm_start; - u32 agp_buffers_offset; + unsigned long agp_buffers_offset; int cp_mode; int cp_running; @@ -83,6 +83,7 @@ typedef struct drm_radeon_private { int usec_timeout; int is_pci; + unsigned long phys_pci_gart; atomic_t idle_count; @@ -433,6 +434,12 @@ extern int radeon_cp_indirect( struct inode *inode, struct file *filp, #define RADEON_AIC_CNTL 0x01d0 # define RADEON_PCIGART_TRANSLATE_EN (1 << 0) +#define RADEON_AIC_STAT 0x01d4 +#define RADEON_AIC_PT_BASE 0x01d8 +#define RADEON_AIC_LO_ADDR 0x01dc +#define RADEON_AIC_HI_ADDR 0x01e0 +#define RADEON_AIC_TLB_ADDR 0x01e4 +#define RADEON_AIC_TLB_DATA 0x01e8 /* CP command packets */ #define RADEON_CP_PACKET0 0x00000000 @@ -508,18 +515,47 @@ extern int radeon_cp_indirect( struct inode *inode, struct file *filp, #define RADEON_RING_HIGH_MARK 128 -#define RADEON_BASE(reg) ((u32)(dev_priv->mmio->handle)) +#define RADEON_BASE(reg) ((unsigned long)(dev_priv->mmio->handle)) #define RADEON_ADDR(reg) (RADEON_BASE( reg ) + reg) #define RADEON_DEREF(reg) *(volatile u32 *)RADEON_ADDR( reg ) +#ifdef __alpha__ +#define RADEON_READ(reg) (_RADEON_READ((u32 *)RADEON_ADDR( reg ))) +static inline u32 _RADEON_READ(u32 *addr) +{ + mb(); + return *(volatile u32 *)addr; +} +#define RADEON_WRITE(reg,val) \ +do { \ + wmb(); \ + RADEON_DEREF(reg) = val; \ +} while (0) +#else #define RADEON_READ(reg) RADEON_DEREF( reg ) #define RADEON_WRITE(reg, val) do { RADEON_DEREF( reg ) = val; } while (0) +#endif #define RADEON_DEREF8(reg) *(volatile u8 *)RADEON_ADDR( reg ) +#ifdef __alpha__ +#define RADEON_READ8(reg) _RADEON_READ8((u8 *)RADEON_ADDR( reg )) +static inline u8 _RADEON_READ8(u8 *addr) +{ + mb(); + return *(volatile u8 *)addr; +} +#define RADEON_WRITE8(reg,val) \ +do { \ + wmb(); \ + RADEON_DEREF8( reg ) = val; \ +} while (0) +#else #define RADEON_READ8(reg) RADEON_DEREF8( reg ) #define RADEON_WRITE8(reg, val) do { RADEON_DEREF8( reg ) = val; } while (0) +#endif -#define RADEON_WRITE_PLL( addr, val ) do { \ +#define RADEON_WRITE_PLL( addr, val ) \ +do { \ RADEON_WRITE8( RADEON_CLOCK_CNTL_INDEX, \ ((addr) & 0x1f) | RADEON_PLL_WR_EN ); \ RADEON_WRITE( RADEON_CLOCK_CNTL_DATA, (val) ); \ @@ -673,7 +709,7 @@ do { \ #define ADVANCE_RING() do { \ if ( RADEON_VERBOSE ) { \ - DRM_INFO( "ADVANCE_RING() tail=0x%06x wr=0x%06x\n", \ + DRM_INFO( "ADVANCE_RING() wr=0x%06x tail=0x%06x\n", \ write, dev_priv->ring.tail ); \ } \ radeon_flush_write_combine(); \ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c index 9360c43b0..0a209245b 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c @@ -1227,8 +1227,8 @@ int radeon_cp_vertex( struct inode *inode, struct file *filp, LOCK_TEST_WITH_RETURN( dev ); - if ( !dev_priv || dev_priv->is_pci ) { - DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ ); + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); return -EINVAL; } @@ -1290,8 +1290,8 @@ int radeon_cp_indices( struct inode *inode, struct file *filp, LOCK_TEST_WITH_RETURN( dev ); - if ( !dev_priv || dev_priv->is_pci ) { - DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ ); + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); return -EINVAL; } @@ -1420,8 +1420,8 @@ int radeon_cp_indirect( struct inode *inode, struct file *filp, LOCK_TEST_WITH_RETURN( dev ); - if ( !dev_priv || dev_priv->is_pci ) { - DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ ); + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); return -EINVAL; } 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 a7be5031c..ffc85d8cb 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.18 2001/03/21 18:08:54 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.20 2001/04/18 18:44:39 dawes Exp $ * */ @@ -35,11 +35,9 @@ # include "xf86.h" # include "xf86_OSproc.h" # include "xf86_ansic.h" -# include "xf86Priv.h" # define _DRM_MALLOC xalloc # define _DRM_FREE xfree # ifndef XFree86LOADER -# include <sys/stat.h> # include <sys/mman.h> # endif #else @@ -53,6 +51,7 @@ # include <signal.h> # include <sys/types.h> # include <sys/stat.h> +# define stat_t struct stat # include <sys/ioctl.h> # include <sys/mman.h> # include <sys/time.h> @@ -68,7 +67,7 @@ extern int xf86RemoveSIGIOHandler(int fd); # endif #endif -#ifdef __alpha__ +#if defined(__alpha__) && defined(__linux__) extern unsigned long _bus_base(void); #define BUS_BASE _bus_base() #endif @@ -141,11 +140,7 @@ static char *drmStrdup(const char *s) static unsigned long drmGetKeyFromFd(int fd) { -#ifdef XFree86LOADER - struct xf86stat st; -#else - struct stat st; -#endif + stat_t st; st.st_rdev = 0; fstat(fd, &st); @@ -225,7 +220,7 @@ static int drmOpenDevice(long dev, int minor) return -errno; } -int drmOpenMinor(int minor, int create) +static int drmOpenMinor(int minor, int create) { int fd; char buf[64]; @@ -1007,6 +1002,28 @@ unsigned int drmAgpDeviceId(int fd) return i.id_device; } +int drmScatterGatherAlloc(int fd, unsigned long size, unsigned long *handle) +{ + drm_scatter_gather_t sg; + + *handle = 0; + sg.size = size; + sg.handle = 0; + if (ioctl(fd, DRM_IOCTL_SG_ALLOC, &sg)) return -errno; + *handle = sg.handle; + return 0; +} + +int drmScatterGatherFree(int fd, unsigned long handle) +{ + drm_scatter_gather_t sg; + + sg.size = 0; + sg.handle = handle; + if (ioctl(fd, DRM_IOCTL_SG_FREE, &sg)) return -errno; + return 0; +} + int drmError(int err, const char *label) { switch (err) { diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c index 064340e08..f39dbdd8f 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c @@ -1,14 +1,12 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c,v 1.4 2001/03/21 18:08:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c,v 1.5 2001/04/10 16:08:04 dawes Exp $ */ #ifdef XFree86Server # include "xf86.h" # include "xf86_OSproc.h" # include "xf86_ansic.h" -# include "xf86Priv.h" # define _DRM_MALLOC xalloc # define _DRM_FREE xfree # ifndef XFree86LOADER -# include <sys/stat.h> # include <sys/mman.h> # endif #else @@ -21,7 +19,6 @@ # include <errno.h> # include <signal.h> # include <sys/types.h> -# include <sys/stat.h> # include <sys/ioctl.h> # include <sys/mman.h> # include <sys/time.h> diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c index 2ba199fdb..cde110d72 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c @@ -27,17 +27,15 @@ * Gareth Hughes <gareth@valinux.com> * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c,v 1.4 2001/03/21 18:08:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c,v 1.5 2001/04/10 16:08:04 dawes Exp $ */ #ifdef XFree86Server # include "xf86.h" # include "xf86_OSproc.h" # include "xf86_ansic.h" -# include "xf86Priv.h" # define _DRM_MALLOC xalloc # define _DRM_FREE xfree # ifndef XFree86LOADER -# include <sys/stat.h> # include <sys/mman.h> # endif #else @@ -50,7 +48,6 @@ # include <errno.h> # include <signal.h> # include <sys/types.h> -# include <sys/stat.h> # include <sys/ioctl.h> # include <sys/mman.h> # include <sys/time.h> @@ -78,7 +75,7 @@ extern int xf86RemoveSIGIOHandler(int fd); #include "xf86drmMga.h" #include "drm.h" -#define MGA_IDLE_RETRY 128 +#define MGA_IDLE_RETRY 2048 int drmMGAInitDMA( int fd, drmMGAInit *info ) 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 c10ee7924..4a4cb98a6 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,17 +26,15 @@ * Author: Kevin E. Martin <martin@valinux.com> * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c,v 1.8 2001/03/21 18:08:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c,v 1.9 2001/04/10 16:08:04 dawes Exp $ */ #ifdef XFree86Server # include "xf86.h" # include "xf86_OSproc.h" # include "xf86_ansic.h" -# include "xf86Priv.h" # define _DRM_MALLOC xalloc # define _DRM_FREE xfree # ifndef XFree86LOADER -# include <sys/stat.h> # include <sys/mman.h> # endif #else @@ -49,7 +47,6 @@ # include <errno.h> # include <signal.h> # include <sys/types.h> -# include <sys/stat.h> # include <sys/ioctl.h> # include <sys/mman.h> # include <sys/time.h> diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c index ff3fadae6..18778f99e 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c @@ -27,17 +27,15 @@ * Kevin E. Martin <martin@valinux.com> * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c,v 1.2 2001/03/21 18:08:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c,v 1.3 2001/04/10 16:08:04 dawes Exp $ */ #ifdef XFree86Server # include "xf86.h" # include "xf86_OSproc.h" # include "xf86_ansic.h" -# include "xf86Priv.h" # define _DRM_MALLOC xalloc # define _DRM_FREE xfree # ifndef XFree86LOADER -# include <sys/stat.h> # include <sys/mman.h> # endif #else @@ -50,7 +48,6 @@ # include <errno.h> # include <signal.h> # include <sys/types.h> -# include <sys/stat.h> # include <sys/ioctl.h> # include <sys/mman.h> # include <sys/time.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 4d101c1a1..ef0ae01bd 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,14 +1,12 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c,v 1.4 2001/01/08 01:07:37 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c,v 1.5 2001/04/10 16:08:04 dawes Exp $ */ #ifdef XFree86Server # include "xf86.h" # include "xf86_OSproc.h" # include "xf86_ansic.h" -# include "xf86Priv.h" # define _DRM_MALLOC xalloc # define _DRM_FREE xfree # ifndef XFree86LOADER -# include <sys/stat.h> # include <sys/mman.h> # endif #else @@ -21,7 +19,6 @@ # include <errno.h> # include <signal.h> # include <sys/types.h> -# include <sys/stat.h> # include <sys/ioctl.h> # include <sys/mman.h> # include <sys/time.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 e49583d78..6c8775c0e 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.49 2001/04/05 21:29:18 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.50 2001/04/10 16:08:03 dawes Exp $ */ /* * Copyright 1992 by Orest Zborowski <obz@Kodak.com> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -700,15 +700,16 @@ readSparse8(pointer Base, register unsigned long Offset) mem_barrier(); Offset += (unsigned long)Base - (unsigned long)lnxBase; shift = (Offset & 0x3) << 3; - if (Offset >= (hae_thresh)) { + if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; Offset -= msb; if (msb_set != msb) { - sethae(msb); - msb_set = msb; + sethae(msb); + msb_set = msb; } - } + } + mem_barrier(); result = *(vuip) ((unsigned long)lnxSBase + (Offset << 5)); result >>= shift; return 0xffUL & result; @@ -723,14 +724,16 @@ readSparse16(pointer Base, register unsigned long Offset) mem_barrier(); Offset += (unsigned long)Base - (unsigned long)lnxBase; shift = (Offset & 0x2) << 3; - if (Offset >= hae_thresh) { + if (Offset >= hae_thresh) { msb = Offset & hae_mask; Offset -= msb; - if (msb_set != msb) { - sethae(msb); - msb_set = msb; - } + if (msb_set != msb) { + sethae(msb); + msb_set = msb; + } } + + mem_barrier(); result = *(vuip)((unsigned long)lnxSBase+(Offset<<5)+(1<<(5-2))); result >>= shift; return 0xffffUL & result; @@ -752,13 +755,15 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset) write_mem_barrier(); Offset += (unsigned long)Base - (unsigned long)lnxBase; if (Offset >= hae_thresh) { - msb = Offset & hae_mask; - Offset -= msb; - if (msb_set != msb) { - sethae(msb); - msb_set = msb; - } + msb = Offset & hae_mask; + Offset -= msb; + if (msb_set != msb) { + sethae(msb); + msb_set = msb; + } } + + write_mem_barrier(); *(vuip) ((unsigned long)lnxSBase + (Offset << 5)) = b * 0x01010101; } @@ -771,13 +776,15 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset) write_mem_barrier(); Offset += (unsigned long)Base - (unsigned long)lnxBase; if (Offset >= hae_thresh) { - msb = Offset & hae_mask; - Offset -= msb; - if (msb_set != msb) { - sethae(msb); - msb_set = msb; - } + msb = Offset & hae_mask; + Offset -= msb; + if (msb_set != msb) { + sethae(msb); + msb_set = msb; + } } + + write_mem_barrier(); *(vuip)((unsigned long)lnxSBase+(Offset<<5)+(1<<(5-2))) = w * 0x00010001; } @@ -798,12 +805,12 @@ writeSparseNB8(int Value, pointer Base, register unsigned long Offset) Offset += (unsigned long)Base - (unsigned long)lnxBase; if (Offset >= hae_thresh) { - msb = Offset & hae_mask; - Offset -= msb; - if (msb_set != msb) { - sethae(msb); - msb_set = msb; - } + msb = Offset & hae_mask; + Offset -= msb; + if (msb_set != msb) { + sethae(msb); + msb_set = msb; + } } *(vuip) ((unsigned long)lnxSBase + (Offset << 5)) = b * 0x01010101; } @@ -816,12 +823,12 @@ writeSparseNB16(int Value, pointer Base, register unsigned long Offset) Offset += (unsigned long)Base - (unsigned long)lnxBase; if (Offset >= hae_thresh) { - msb = Offset & hae_mask; - Offset -= msb; - if (msb_set != msb) { - sethae(msb); - msb_set = msb; - } + msb = Offset & hae_mask; + Offset -= msb; + if (msb_set != msb) { + sethae(msb); + msb_set = msb; + } } *(vuip)((unsigned long)lnxSBase+(Offset<<5)+(1<<(5-2))) = w * 0x00010001; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h index f1abaabff..3def97f74 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h @@ -126,10 +126,11 @@ typedef struct drm_control { } drm_control_t; typedef enum drm_map_type { - _DRM_FRAME_BUFFER = 0, /* WC (no caching), no core dump */ - _DRM_REGISTERS = 1, /* no caching, no core dump */ - _DRM_SHM = 2, /* shared, cached */ - _DRM_AGP = 3 /* AGP/GART */ + _DRM_FRAME_BUFFER = 0, /* WC (no caching), no core dump */ + _DRM_REGISTERS = 1, /* no caching, no core dump */ + _DRM_SHM = 2, /* shared, cached */ + _DRM_AGP = 3, /* AGP/GART */ + _DRM_SCATTER_GATHER = 4 /* Scatter/gather memory for PCI DMA */ } drm_map_type_t; typedef enum drm_map_flags { @@ -238,7 +239,8 @@ typedef struct drm_buf_desc { int high_mark; /* High water mark */ enum { _DRM_PAGE_ALIGN = 0x01, /* Align on page boundaries for DMA */ - _DRM_AGP_BUFFER = 0x02 /* Buffer is in agp space */ + _DRM_AGP_BUFFER = 0x02, /* Buffer is in agp space */ + _DRM_SG_BUFFER = 0x04 /* Scatter/gather memory buffer */ } flags; unsigned long agp_start; /* Start address of where the agp buffers * are in the agp aperture */ @@ -344,6 +346,11 @@ typedef struct drm_agp_info { unsigned short id_device; } drm_agp_info_t; +typedef struct drm_scatter_gather { + unsigned long size; /* In bytes -- will round to page boundary */ + unsigned long handle; /* Used for mapping / unmapping */ +} drm_scatter_gather_t; + #define DRM_IOCTL_BASE 'd' #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) #define DRM_IOR(nr,size) _IOR(DRM_IOCTL_BASE,nr,size) @@ -399,6 +406,9 @@ typedef struct drm_agp_info { #define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t) #define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t) +#define DRM_IOCTL_SG_ALLOC DRM_IOW( 0x38, drm_scatter_gather_t) +#define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, drm_scatter_gather_t) + /* MGA specific ioctls */ #define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t) #define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x41, drm_lock_t) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile index c000180a5..65b24cf6f 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile,v 1.7 2000/08/15 16:05:40 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile,v 1.8 2001/04/07 16:37:16 dawes Exp $ @@ -29,7 +29,7 @@ OBJS = sol8_init.o sol8_vid.o sol8_bios.o sol8_kbd.o sol8_io.o \ kmod_noop.o agp_noop.o INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) -I$(EXTINCSRC) + -I$(SERVERSRC)/mi -I$(XINCLUDESRC) -I$(EXTINCSRC) RESDEFINES = -DUSESTDRES diff --git a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h index d57b4f9b3..f1ec6dbc8 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h,v 1.9 2001/03/07 19:53:18 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h,v 1.10 2001/04/07 16:37:16 dawes Exp $ */ #ifndef _SOL8KEYNAMES_H #define _SOL8KEYNAMES_H @@ -141,7 +141,7 @@ unsigned char sol8map[256] = { KEY_UNKNOWN, /* 130 */ KEY_NFER, /* 131 */ KEY_XFER, /* 132 */ - KEY_HKTG /* 133 */ + KEY_HKTG, /* 133 */ KEY_UNKNOWN, /* 134 */ /* The rest default to KEY_UNKNOWN */ }; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h index a5ee75d0b..f4c78d3bd 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.79 2001/03/03 09:53:00 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.80 2001/04/20 16:54:05 tsi Exp $ */ /* * Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany * Copyright 1992 by David Dawes <dawes@XFree86.org> @@ -126,12 +126,12 @@ extern int vsnprintf(char *str, size_t size, const char *format, va_list ap); # include <sys/param.h> # endif -#ifdef ISC -#define TIOCMSET (TIOC|26) /* set all modem bits */ -#define TIOCMBIS (TIOC|27) /* bis modem bits */ -#define TIOCMBIC (TIOC|28) /* bic modem bits */ -#define TIOCMGET (TIOC|29) /* get all modem bits */ -#endif +# ifdef ISC +# define TIOCMSET (TIOC|26) /* set all modem bits */ +# define TIOCMBIS (TIOC|27) /* bis modem bits */ +# define TIOCMBIC (TIOC|28) /* bic modem bits */ +# define TIOCMGET (TIOC|29) /* get all modem bits */ +# endif # include <errno.h> @@ -153,8 +153,6 @@ extern int vsnprintf(char *str, size_t size, const char *format, va_list ap); # if defined(sun) && defined (i386) && defined (SVR4) /* Solaris? */ # if !defined(V86SC_IOPL) /* Solaris 7? */ # include <sys/v86.h> /* Nope */ -# else - /* Do nothing what so ever */ /* Yup */ # endif /* V86SC_IOPL */ # else # include <sys/v86.h> /* Not solaris */ @@ -164,16 +162,18 @@ extern int vsnprintf(char *str, size_t size, const char *format, va_list ap); # endif # endif /* _NEED_SYSI86 */ -#if defined(HAS_SVR3_MMAPDRV) -# include <sys/sysmacros.h> -# if !defined(_NEED_SYSI86) -# include <sys/immu.h> -# include <sys/region.h> +# if defined(HAS_SVR3_MMAPDRV) +# include <sys/sysmacros.h> +# if !defined(_NEED_SYSI86) +# include <sys/immu.h> +# include <sys/region.h> +# endif +# include <sys/mmap.h> /* MMAP driver header */ # endif -# include <sys/mmap.h> /* MMAP driver header */ -#endif -# define HAS_USL_VTS +# if !defined(sun) || !defined(sparc) +# define HAS_USL_VTS +# endif # if !defined(sun) # include <sys/emap.h> # endif @@ -185,7 +185,7 @@ extern int vsnprintf(char *str, size_t size, const char *format, va_list ap); # define LED_CAP 0x01 # define LED_NUM 0x02 # define LED_SCR 0x04 -# else /* SCO */ +# elif defined(HAS_USL_VTS) # include <sys/at_ansi.h> # include <sys/kd.h> # include <sys/vt.h> @@ -226,35 +226,25 @@ extern int vsnprintf(char *str, size_t size, const char *format, va_list ap); # endif # if defined(ATT) && !defined(i386) -# define i386 /* note defined in ANSI C mode */ +# define i386 /* not defined in ANSI C mode */ # endif /* ATT && !i386 */ -# if (defined(ATT) || defined(SVR4)) && !(defined(sun) && defined (i386) && defined (SVR4)) && !defined(SCO325) +# if (defined(ATT) || defined(SVR4)) && !defined(sun) && !defined(SCO325) # ifndef XQUEUE # define XQUEUE # endif # include <sys/xque.h> # endif /* ATT || SVR4 */ -#if 0 -/* Hack on SVR3 and SVR4 to avoid linking in Xenix or BSD support */ -#if defined (sun) && defined (i386) && defined (SVR4) -extern int xf86_solx86usleep(unsigned long); -# define usleep(usec) xf86_solx86usleep(usec) -#else -# define usleep(usec) syscall(3112, (usec) / 1000 + 1) -#endif /* sun && i386 && SVR4 */ -#endif - # ifdef SYSV # if !defined(ISC) || defined(ISC202) || defined(ISC22) # define NEED_STRERROR # endif # endif -#ifndef NULL -# define NULL 0 -#endif +# ifndef NULL +# define NULL 0 +# endif #endif /* (SYSV || SVR4) && !DGUX */ @@ -263,20 +253,22 @@ extern int xf86_solx86usleep(unsigned long); ***********/ #ifdef __SOL8__ -#include <sys/mman.h> -#include <errno.h> -#include <sys/sysi86.h> -#include <sys/psw.h> +# include <sys/mman.h> +# include <errno.h> +# ifdef i386 +# include <sys/sysi86.h> +# endif +# include <sys/psw.h> -#include <termio.h> -#include <sys/kbd.h> -#include <sys/kbio.h> +# include <termio.h> +# include <sys/kbd.h> +# include <sys/kbio.h> -#define LED_CAP LED_CAPS_LOCK -#define LED_NUM LED_NUM_LOCK -#define LED_SCR LED_SCROLL_LOCK +# define LED_CAP LED_CAPS_LOCK +# define LED_NUM LED_NUM_LOCK +# define LED_SCR LED_SCROLL_LOCK -#include <signal.h> +# include <signal.h> #endif /* __SOL8__ */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h index c7c6fd2b3..99d5aeda6 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h @@ -64,7 +64,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.50 2001/02/15 11:03:54 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.51 2001/04/16 15:02:13 tsi Exp $ */ #ifndef _XF86_OSPROC_H #define _XF86_OSPROC_H @@ -245,7 +245,7 @@ resPtr xf86IsaBusAccWindowsFromOS(void); resPtr xf86AccResFromOS(resPtr ret); #endif /* NEED_OS_RAC_PROTOS */ -Bool xf86GetPciSizeFromOS(PCITAG tag, int index, int* bits); +Bool xf86GetPciSizeFromOS(PCITAG tag, int indx, int* bits); #endif /* XF86_OS_PRIVS */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h index e8be0690a..03138c8d5 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h,v 3.45 2001/03/03 22:53:02 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h,v 3.46 2001/04/10 16:08:03 dawes Exp $ */ #ifndef _XF86_ANSIC_H #define _XF86_ANSIC_H @@ -318,6 +318,8 @@ extern void xf86longjmp(xf86jmp_buf env, int val); #include <sys/ipc.h> #include <sys/shm.h> #endif +#include <sys/stat.h> +#define stat_t struct stat #endif /* XFree86LOADER || NEED_XF86_PROTOTYPES */ /* diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h index 09dffe9ad..7c9de85db 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h,v 3.49 2000/09/19 12:46:21 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h,v 3.50 2001/04/10 16:08:03 dawes Exp $ */ @@ -64,7 +64,7 @@ typedef unsigned int xf86uid_t; typedef unsigned int xf86gid_t; struct xf86stat { - xf86dev_t st_rdev; /* This is incomplete */ + xf86dev_t st_rdev; /* This is incomplete, and makes assumptions */ }; /* sysv IPC */ @@ -499,6 +499,7 @@ typedef int xf86jmp_buf[20]; #define gid_t xf86gid_t #undef jmp_buf #define jmp_buf xf86jmp_buf +#define stat_t struct xf86stat /* * There should be no need to #undef any of these. If they are already diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h index 664e6855b..93764058a 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.13 2001/03/21 18:08:53 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.14 2001/04/10 16:08:03 dawes Exp $ * */ @@ -93,7 +93,8 @@ typedef enum { DRM_FRAME_BUFFER = 0, /* WC, no caching, no core dump */ DRM_REGISTERS = 1, /* no caching, no core dump */ DRM_SHM = 2, /* shared, cached */ - DRM_AGP = 3 /* AGP/GART */ + DRM_AGP = 3, /* AGP/GART */ + DRM_SCATTER_GATHER = 4 /* PCI scatter/gather */ } drmMapType; typedef enum { @@ -125,7 +126,8 @@ typedef enum { /* These values *MUST* match drm.h */ typedef enum { DRM_PAGE_ALIGN = 0x01, - DRM_AGP_BUFFER = 0x02 + DRM_AGP_BUFFER = 0x02, + DRM_SG_BUFFER = 0x04 } drmBufDescFlags; typedef enum { @@ -313,6 +315,25 @@ do { register unsigned int __old __asm("o0"); \ } while (0) #endif + +#elif defined(__powerpc__) + +#define DRM_CAS(lock,old,new,__ret) \ + do { \ + __asm__ __volatile__( \ + "sync;" \ + "0: lwarx %0,0,%1;" \ + " xor. %0,%3,%0;" \ + " bne 1f;" \ + " stwcx. %2,0,%1;" \ + " bne- 0b;" \ + "1: " \ + "sync;" \ + : "=&r"(__ret) \ + : "r"(lock), "r"(new), "r"(old) \ + : "cr0", "memory"); \ + } while (0) + #endif /* architecture */ #endif /* __GNUC__ >= 2 */ @@ -498,6 +519,11 @@ extern unsigned long drmAgpMemoryAvail(int fd); extern unsigned int drmAgpVendorId(int fd); extern unsigned int drmAgpDeviceId(int fd); +/* PCI scatter/gather support: X server (root) only */ +extern int drmScatterGatherAlloc(int fd, unsigned long size, + unsigned long *handle); +extern int drmScatterGatherFree(int fd, unsigned long handle); + /* Support routines */ extern int drmError(int err, const char *label); extern void *drmMalloc(int size); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h index 0a4e072bb..3eb47605d 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h,v 3.4 2001/03/21 18:08:53 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h,v 3.6 2001/04/16 15:02:13 tsi Exp $ */ #ifndef __XF86DRI_MGA_H__ #define __XF86DRI_MGA_H__ @@ -15,7 +15,7 @@ typedef struct { } drmMGAWarpIndex; typedef struct { - int sarea_priv_offset; + unsigned long sarea_priv_offset; int chipset; int sgram; @@ -32,12 +32,12 @@ typedef struct { unsigned int texture_offset[2]; unsigned int texture_size[2]; - unsigned int fb_offset; - unsigned int mmio_offset; - unsigned int status_offset; - unsigned int warp_offset; - unsigned int primary_offset; - unsigned int buffers_offset; + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long status_offset; + unsigned long warp_offset; + unsigned long primary_offset; + unsigned long buffers_offset; } drmMGAInit; extern int drmMGAInitDMA( int fd, drmMGAInit *info ); @@ -54,11 +54,11 @@ extern int drmMGAClear( int fd, unsigned int flags, unsigned int clear_color, unsigned int clear_depth, unsigned int color_mask, unsigned int depth_mask ); -extern int drmMGAFlushVertexBuffer( int fd, int index, int used, int discard ); -extern int drmMGAFlushIndices( int fd, int index, +extern int drmMGAFlushVertexBuffer( int fd, int indx, int used, int discard ); +extern int drmMGAFlushIndices( int fd, int indx, int start, int end, int discard ); -extern int drmMGATextureLoad( int fd, int index, +extern int drmMGATextureLoad( int fd, int indx, unsigned int dstorg, unsigned int length ); extern int drmMGAAgpBlit( int fd, unsigned int planemask, diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h index b4973b0b3..3bd245da8 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h @@ -27,7 +27,7 @@ * Gareth Hughes <gareth@valinux.com> * Kevin E. Martin <martin@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h,v 3.9 2001/03/25 05:32:13 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h,v 3.11 2001/04/16 15:02:13 tsi Exp $ * */ @@ -46,7 +46,7 @@ #define DRM_R128_DEPTH 0x4 typedef struct { - int sarea_priv_offset; + unsigned long sarea_priv_offset; int is_pci; int cce_mode; int cce_secure; /* FIXME: Deprecated, we should remove this */ @@ -60,12 +60,12 @@ typedef struct { unsigned int depth_offset, depth_pitch; unsigned int span_offset; - unsigned int fb_offset; - unsigned int mmio_offset; - unsigned int ring_offset; - unsigned int ring_rptr_offset; - unsigned int buffers_offset; - unsigned int agp_textures_offset; + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long ring_offset; + unsigned long ring_rptr_offset; + unsigned long buffers_offset; + unsigned long agp_textures_offset; } drmR128Init; extern int drmR128InitCCE( int fd, drmR128Init *info ); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h index abf94b657..a9949d6bd 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h @@ -27,7 +27,7 @@ * Gareth Hughes <gareth@valinux.com> * Kevin E. Martin <martin@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h,v 1.4 2001/03/25 05:32:13 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h,v 1.6 2001/04/16 15:02:13 tsi Exp $ * */ @@ -43,7 +43,7 @@ #define DRM_RADEON_DEPTH 0x4 typedef struct { - int sarea_priv_offset; + unsigned long sarea_priv_offset; int is_pci; int cp_mode; int agp_size; @@ -56,12 +56,12 @@ typedef struct { unsigned int depth_bpp; unsigned int depth_offset, depth_pitch; - unsigned int fb_offset; - unsigned int mmio_offset; - unsigned int ring_offset; - unsigned int ring_rptr_offset; - unsigned int buffers_offset; - unsigned int agp_textures_offset; + unsigned long fb_offset; + unsigned long mmio_offset; + unsigned long ring_offset; + unsigned long ring_rptr_offset; + unsigned long buffers_offset; + unsigned long agp_textures_offset; } drmRadeonInit; typedef struct { diff --git a/xc/programs/Xserver/hw/xfree86/ramdac/IBM.c b/xc/programs/Xserver/hw/xfree86/ramdac/IBM.c index 281cb561e..69a9d3864 100644 --- a/xc/programs/Xserver/hw/xfree86/ramdac/IBM.c +++ b/xc/programs/Xserver/hw/xfree86/ramdac/IBM.c @@ -23,7 +23,7 @@ * * IBM RAMDAC routines. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/IBM.c,v 1.10 1999/03/28 15:33:01 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/IBM.c,v 1.11 2001/04/09 00:04:12 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -396,8 +396,17 @@ IBMramdac640SetBpp(ScrnInfoPtr pScrn, RamDacRegRecPtr ramdacReg) ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PCLK_8; /* pll / 8 */ bpp = 0x03; break; + case 15: + ramdacReg->DacRegs[RGB640_SER_07_00] = 0x10; + ramdacReg->DacRegs[RGB640_SER_15_08] = 0x11; + ramdacReg->DacRegs[RGB640_SER_23_16] = 0x00; + ramdacReg->DacRegs[RGB640_SER_31_24] = 0x00; + ramdacReg->DacRegs[RGB640_SER_MODE] = IBM640_SER_8_1; /* 8:1 Mux*/ + ramdacReg->DacRegs[RGB640_MISC_CONF] = IBM640_PCLK_8; /* pll / 8 */ + bpp = 0x0E; + break; case 16: - ramdacReg->DacRegs[RGB640_SER_07_00] = 0x10; + ramdacReg->DacRegs[RGB640_SER_07_00] = 0x10; ramdacReg->DacRegs[RGB640_SER_15_08] = 0x11; ramdacReg->DacRegs[RGB640_SER_23_16] = 0x00; ramdacReg->DacRegs[RGB640_SER_31_24] = 0x00; diff --git a/xc/programs/Xserver/hw/xfree86/ramdac/Imakefile b/xc/programs/Xserver/hw/xfree86/ramdac/Imakefile index c4a0c32fe..ed2596233 100644 --- a/xc/programs/Xserver/hw/xfree86/ramdac/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/ramdac/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/Imakefile,v 1.9 1999/08/14 10:50:07 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/Imakefile,v 1.10 2001/04/23 16:17:11 tsi Exp $ #define IHaveModules #include <Server.tmpl> @@ -20,7 +20,7 @@ OBJS = $(MODOBJ) xf86RamDac.o xf86RamDacCmap.o xf86Cursor.o xf86HWCurs.o \ LINTLIBS = ../../../dix/llib-ldix.ln ../../../os/llib-los.ln \ ../../mfb/llib-lmfb.ln ../../mi/llib-lmi.ln -DEPEND_DEFINES = -DRAMDAC_MODULE +DEPEND_DEFINES = -DRAMDAC_MODULE DependDefines ModuleObjectRule() diff --git a/xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c b/xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c index 5e26ff098..31418fbdc 100644 --- a/xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c +++ b/xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c,v 1.7 2000/04/24 23:40:27 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c,v 1.8 2001/04/19 14:14:06 tsi Exp $ */ #include "misc.h" #include "xf86.h" @@ -38,8 +38,8 @@ static miPointerSpriteFuncRec xf86CursorSpriteFuncs = { static void xf86CursorInstallColormap(ColormapPtr); static void xf86CursorRecolorCursor(ScreenPtr, CursorPtr, Bool); static Bool xf86CursorCloseScreen(int, ScreenPtr); -static void xf86CursorQueryBestSize(int, unsigned short*, unsigned short*, - ScreenPtr); +static void xf86CursorQueryBestSize(int, unsigned short*, unsigned short*, + ScreenPtr); /* ScrnInfoRec functions */ @@ -48,30 +48,30 @@ static Bool xf86CursorEnterVT(int, int); static void xf86CursorLeaveVT(int, int); static int xf86SetDGAMode(int, int, DGADevicePtr); - -Bool +Bool xf86InitCursor( - ScreenPtr pScreen, + ScreenPtr pScreen, xf86CursorInfoPtr infoPtr ) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; xf86CursorScreenPtr ScreenPriv; miPointerScreenPtr PointPriv; - - if(xf86CursorGeneration != serverGeneration) { - if((xf86CursorScreenIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - xf86CursorGeneration = serverGeneration; + + if (xf86CursorGeneration != serverGeneration) { + if ((xf86CursorScreenIndex = AllocateScreenPrivateIndex()) < 0) + return FALSE; + xf86CursorGeneration = serverGeneration; } - if(!xf86InitHardwareCursor(pScreen, infoPtr)) + if (!xf86InitHardwareCursor(pScreen, infoPtr)) return FALSE; ScreenPriv = xcalloc(1, sizeof(xf86CursorScreenRec)); - if(!ScreenPriv) return FALSE; + if (!ScreenPriv) + return FALSE; - pScreen->devPrivates[xf86CursorScreenIndex].ptr = (pointer)ScreenPriv; + pScreen->devPrivates[xf86CursorScreenIndex].ptr = ScreenPriv; ScreenPriv->SWCursor = TRUE; ScreenPriv->isUp = FALSE; @@ -87,27 +87,31 @@ xf86InitCursor( ScreenPriv->RecolorCursor = pScreen->RecolorCursor; pScreen->RecolorCursor = xf86CursorRecolorCursor; - if((infoPtr->pScrn->bitsPerPixel == 8) && - !(infoPtr->Flags & HARDWARE_CURSOR_TRUECOLOR_AT_8BPP)) { + if ((infoPtr->pScrn->bitsPerPixel == 8) && + !(infoPtr->Flags & HARDWARE_CURSOR_TRUECOLOR_AT_8BPP)) { ScreenPriv->InstallColormap = pScreen->InstallColormap; pScreen->InstallColormap = xf86CursorInstallColormap; ScreenPriv->PalettedCursor = TRUE; } - PointPriv = - (miPointerScreenPtr)pScreen->devPrivates[miPointerScreenIndex].ptr; + PointPriv = pScreen->devPrivates[miPointerScreenIndex].ptr; + ScreenPriv->showTransparent = PointPriv->showTransparent; + if (infoPtr->Flags & HARDWARE_CURSOR_SHOW_TRANSPARENT) + PointPriv->showTransparent = TRUE; + else + PointPriv->showTransparent = FALSE; ScreenPriv->spriteFuncs = PointPriv->spriteFuncs; - PointPriv->spriteFuncs = &xf86CursorSpriteFuncs; + PointPriv->spriteFuncs = &xf86CursorSpriteFuncs; ScreenPriv->SwitchMode = pScrn->SwitchMode; ScreenPriv->EnterVT = pScrn->EnterVT; ScreenPriv->LeaveVT = pScrn->LeaveVT; ScreenPriv->SetDGAMode = pScrn->SetDGAMode; - if(pScrn->SwitchMode) + if (pScrn->SwitchMode) pScrn->SwitchMode = xf86CursorSwitchMode; - pScrn->EnterVT = xf86CursorEnterVT; + pScrn->EnterVT = xf86CursorEnterVT; pScrn->LeaveVT = xf86CursorLeaveVT; pScrn->SetDGAMode = xf86SetDGAMode; @@ -120,125 +124,125 @@ static Bool xf86CursorCloseScreen(int i, ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - miPointerScreenPtr PointPriv = - (miPointerScreenPtr)pScreen->devPrivates[miPointerScreenIndex].ptr; - xf86CursorScreenPtr ScreenPriv = - (xf86CursorScreenPtr)pScreen->devPrivates[xf86CursorScreenIndex].ptr; + miPointerScreenPtr PointPriv = + pScreen->devPrivates[miPointerScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = + pScreen->devPrivates[xf86CursorScreenIndex].ptr; pScreen->CloseScreen = ScreenPriv->CloseScreen; pScreen->QueryBestSize = ScreenPriv->QueryBestSize; pScreen->RecolorCursor = ScreenPriv->RecolorCursor; - if(ScreenPriv->InstallColormap) + if (ScreenPriv->InstallColormap) pScreen->InstallColormap = ScreenPriv->InstallColormap; PointPriv->spriteFuncs = ScreenPriv->spriteFuncs; + PointPriv->showTransparent = ScreenPriv->showTransparent; pScrn->SwitchMode = ScreenPriv->SwitchMode; - pScrn->EnterVT = ScreenPriv->EnterVT; - pScrn->LeaveVT = ScreenPriv->LeaveVT; + pScrn->EnterVT = ScreenPriv->EnterVT; + pScrn->LeaveVT = ScreenPriv->LeaveVT; pScrn->SetDGAMode = ScreenPriv->SetDGAMode; - xfree ((pointer) ScreenPriv); + xfree(ScreenPriv); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen)(i, pScreen); } static void xf86CursorQueryBestSize( - int class, + int class, unsigned short *width, unsigned short *height, - ScreenPtr pScreen -){ - xf86CursorScreenPtr ScreenPriv = - (xf86CursorScreenPtr)pScreen->devPrivates[xf86CursorScreenIndex].ptr; + ScreenPtr pScreen) +{ + xf86CursorScreenPtr ScreenPriv = + pScreen->devPrivates[xf86CursorScreenIndex].ptr; - if(class == CursorShape) { + if (class == CursorShape) { *width = ScreenPriv->CursorInfoPtr->MaxWidth; *height = ScreenPriv->CursorInfoPtr->MaxHeight; } else (*ScreenPriv->QueryBestSize)(class, width, height, pScreen); } - -static void + +static void xf86CursorInstallColormap(ColormapPtr pMap) { - xf86CursorScreenPtr ScreenPriv = - (xf86CursorScreenPtr)pMap->pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = + pMap->pScreen->devPrivates[xf86CursorScreenIndex].ptr; ScreenPriv->pInstalledMap = pMap; - + (*ScreenPriv->InstallColormap)(pMap); } - -static void +static void xf86CursorRecolorCursor( - ScreenPtr pScreen, - CursorPtr pCurs, - Bool displayed ) + ScreenPtr pScreen, + CursorPtr pCurs, + Bool displayed) { - xf86CursorScreenPtr ScreenPriv = - (xf86CursorScreenPtr)pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = + pScreen->devPrivates[xf86CursorScreenIndex].ptr; - if(!displayed) return; + if (!displayed) + return; - if(ScreenPriv->SWCursor) + if (ScreenPriv->SWCursor) (*ScreenPriv->RecolorCursor)(pScreen, pCurs, displayed); - else + else xf86RecolorCursor(pScreen, pCurs, displayed); } /***** ScrnInfoRec functions *********/ -static Bool +static Bool xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags) { Bool ret; ScreenPtr pScreen = screenInfo.screens[index]; - xf86CursorScreenPtr ScreenPriv = - (xf86CursorScreenPtr)pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = + pScreen->devPrivates[xf86CursorScreenIndex].ptr; - if(ScreenPriv->isUp) { - xf86SetCursor(pScreen, 0, ScreenPriv->x, ScreenPriv->y); + if (ScreenPriv->isUp) { + xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y); ScreenPriv->isUp = FALSE; } ret = (*ScreenPriv->SwitchMode)(index, mode, flags); - if(ScreenPriv->CurrentCursor) - xf86CursorSetCursor(pScreen, ScreenPriv->CurrentCursor, + if (ScreenPriv->CurrentCursor) + xf86CursorSetCursor(pScreen, ScreenPriv->CurrentCursor, ScreenPriv->x, ScreenPriv->y); return ret; } - -static Bool +static Bool xf86CursorEnterVT(int index, int flags) { Bool ret; ScreenPtr pScreen = screenInfo.screens[index]; - xf86CursorScreenPtr ScreenPriv = - (xf86CursorScreenPtr)pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = + pScreen->devPrivates[xf86CursorScreenIndex].ptr; ret = (*ScreenPriv->EnterVT)(index, flags); - if(ScreenPriv->CurrentCursor) - xf86CursorSetCursor(pScreen, ScreenPriv->CurrentCursor, + if (ScreenPriv->CurrentCursor) + xf86CursorSetCursor(pScreen, ScreenPriv->CurrentCursor, ScreenPriv->x, ScreenPriv->y); return ret; } -static void +static void xf86CursorLeaveVT(int index, int flags) { ScreenPtr pScreen = screenInfo.screens[index]; - xf86CursorScreenPtr ScreenPriv = - (xf86CursorScreenPtr)pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = + pScreen->devPrivates[xf86CursorScreenIndex].ptr; - if(ScreenPriv->isUp) { - xf86SetCursor(pScreen, 0, ScreenPriv->x, ScreenPriv->y); + if (ScreenPriv->isUp) { + xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y); ScreenPriv->isUp = FALSE; } ScreenPriv->SWCursor = TRUE; @@ -246,68 +250,63 @@ xf86CursorLeaveVT(int index, int flags) (*ScreenPriv->LeaveVT)(index, flags); } - -static int +static int xf86SetDGAMode(int index, int num, DGADevicePtr devRet) { ScreenPtr pScreen = screenInfo.screens[index]; - xf86CursorScreenPtr ScreenPriv = - (xf86CursorScreenPtr)pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = + pScreen->devPrivates[xf86CursorScreenIndex].ptr; int ret; - if(num && ScreenPriv->isUp) { - xf86SetCursor(pScreen, 0, ScreenPriv->x, ScreenPriv->y); + if (num && ScreenPriv->isUp) { + xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y); ScreenPriv->isUp = FALSE; ScreenPriv->SWCursor = TRUE; } ret = (*ScreenPriv->SetDGAMode)(index, num, devRet); - if(ScreenPriv->CurrentCursor && (!num || (ret != Success))) { - xf86CursorSetCursor(pScreen, ScreenPriv->CurrentCursor, + if (ScreenPriv->CurrentCursor && (!num || (ret != Success))) { + xf86CursorSetCursor(pScreen, ScreenPriv->CurrentCursor, ScreenPriv->x, ScreenPriv->y); } return ret; } - /****** miPointerSpriteFunctions *******/ - static Bool xf86CursorRealizeCursor(ScreenPtr pScreen, CursorPtr pCurs) { - xf86CursorScreenPtr ScreenPriv = - (xf86CursorScreenPtr)pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = + pScreen->devPrivates[xf86CursorScreenIndex].ptr; - if(pCurs->refcnt <= 1) + if (pCurs->refcnt <= 1) pCurs->devPriv[pScreen->myNum] = NULL; - return((*ScreenPriv->spriteFuncs->RealizeCursor)(pScreen, pCurs)); + return (*ScreenPriv->spriteFuncs->RealizeCursor)(pScreen, pCurs); } static Bool xf86CursorUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCurs) { - xf86CursorScreenPtr ScreenPriv = - (xf86CursorScreenPtr)pScreen->devPrivates[xf86CursorScreenIndex].ptr; - - if(pCurs->refcnt <= 1) { - pointer privData = pCurs->devPriv[pScreen->myNum]; - if(privData) xfree(privData); + xf86CursorScreenPtr ScreenPriv = + pScreen->devPrivates[xf86CursorScreenIndex].ptr; + + if (pCurs->refcnt <= 1) { + xfree(pCurs->devPriv[pScreen->myNum]); pCurs->devPriv[pScreen->myNum] = NULL; } - return((*ScreenPriv->spriteFuncs->UnrealizeCursor)(pScreen, pCurs)); + return (*ScreenPriv->spriteFuncs->UnrealizeCursor)(pScreen, pCurs); } - static void xf86CursorSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) { - xf86CursorScreenPtr ScreenPriv = - (xf86CursorScreenPtr)pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = + pScreen->devPrivates[xf86CursorScreenIndex].ptr; xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr; miPointerScreenPtr PointPriv; @@ -315,84 +314,73 @@ xf86CursorSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) ScreenPriv->x = x; ScreenPriv->y = y; - if(!pCurs) { /* means we're supposed to remove the cursor */ - if(ScreenPriv->SWCursor) - (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y); - else { - if(ScreenPriv->isUp) xf86SetCursor(pScreen, 0, x, y); + if (pCurs == NullCursor) { /* means we're supposed to remove the cursor */ + if (ScreenPriv->SWCursor) + (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, NullCursor, x, y); + else if (ScreenPriv->isUp) { + xf86SetCursor(pScreen, NullCursor, x, y); ScreenPriv->isUp = FALSE; } return; - } + } ScreenPriv->HotX = pCurs->bits->xhot; ScreenPriv->HotY = pCurs->bits->yhot; - - PointPriv = - (miPointerScreenPtr)pScreen->devPrivates[miPointerScreenIndex].ptr; - - if( infoPtr->pScrn->vtSema && + + PointPriv = pScreen->devPrivates[miPointerScreenIndex].ptr; + + if (infoPtr->pScrn->vtSema && (pCurs->bits->height <= infoPtr->MaxHeight) && (pCurs->bits->width <= infoPtr->MaxWidth) && - (!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor)(pScreen, pCurs))){ + (!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor)(pScreen, pCurs))) { - if(ScreenPriv->SWCursor) /* remove the SW cursor */ - (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y); + if (ScreenPriv->SWCursor) /* remove the SW cursor */ + (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, NullCursor, x, y); xf86SetCursor(pScreen, pCurs, x, y); ScreenPriv->SWCursor = FALSE; ScreenPriv->isUp = TRUE; PointPriv->waitForUpdate = !infoPtr->pScrn->silkenMouse; - return; + return; } PointPriv->waitForUpdate = TRUE; - - if(ScreenPriv->isUp) { - /* remove the HW cursor */ - xf86SetCursor(pScreen, 0, x, y); + + if (ScreenPriv->isUp) { /* remove the HW cursor */ + xf86SetCursor(pScreen, NullCursor, x, y); ScreenPriv->isUp = FALSE; } ScreenPriv->SWCursor = TRUE; + if (pCurs->bits->emptyMask && !ScreenPriv->showTransparent) + pCurs = NullCursor; (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, pCurs, x, y); } static void xf86CursorMoveCursor(ScreenPtr pScreen, int x, int y) { - xf86CursorScreenPtr ScreenPriv = - (xf86CursorScreenPtr)pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = + pScreen->devPrivates[xf86CursorScreenIndex].ptr; ScreenPriv->x = x; ScreenPriv->y = y; - if(ScreenPriv->SWCursor) + if (ScreenPriv->SWCursor) (*ScreenPriv->spriteFuncs->MoveCursor)(pScreen, x, y); - else if(ScreenPriv->isUp) - xf86MoveCursor(pScreen, x, y); + else if (ScreenPriv->isUp) + xf86MoveCursor(pScreen, x, y); } - - -xf86CursorInfoPtr +xf86CursorInfoPtr xf86CreateCursorInfoRec(void) { - return(xcalloc(1,sizeof(xf86CursorInfoRec))); + return xcalloc(1, sizeof(xf86CursorInfoRec)); } - -void +void xf86DestroyCursorInfoRec(xf86CursorInfoPtr infoPtr) { - if(infoPtr) xfree(infoPtr); + xfree(infoPtr); } - - - - - - - - diff --git a/xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h b/xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h index 12a04be1e..17cb98e73 100644 --- a/xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h +++ b/xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h,v 1.5 2001/03/25 05:32:14 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h,v 1.6 2001/04/19 14:14:06 tsi Exp $ */ #ifndef _XF86CURSOR_H #define _XF86CURSOR_H @@ -24,6 +24,7 @@ typedef struct _xf86CursorInfoRec { typedef struct { Bool SWCursor; Bool isUp; + Bool showTransparent; short HotX; short HotY; short x; @@ -71,5 +72,7 @@ extern int xf86CursorScreenIndex; #define HARDWARE_CURSOR_TRUECOLOR_AT_8BPP 0x00000200 #define HARDWARE_CURSOR_BIT_ORDER_MSBFIRST 0x00000400 #define HARDWARE_CURSOR_NIBBLE_SWAPPED 0x00000800 +#define HARDWARE_CURSOR_SHOW_TRANSPARENT 0x00001000 +#define HARDWARE_CURSOR_UPDATE_UNHIDDEN 0x00002000 #endif /* _XF86CURSOR_H */ diff --git a/xc/programs/Xserver/hw/xfree86/ramdac/xf86HWCurs.c b/xc/programs/Xserver/hw/xfree86/ramdac/xf86HWCurs.c index 1cc54991f..288fe7183 100644 --- a/xc/programs/Xserver/hw/xfree86/ramdac/xf86HWCurs.c +++ b/xc/programs/Xserver/hw/xfree86/ramdac/xf86HWCurs.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86HWCurs.c,v 1.6 2000/02/08 13:13:32 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86HWCurs.c,v 1.7 2001/04/19 14:14:06 tsi Exp $ */ #include "misc.h" #include "xf86.h" @@ -47,7 +47,7 @@ xf86CARD64ReverseBits(CARD64 w) p[6] = byte_reversed[p[6]]; p[7] = byte_reversed[p[7]]; - return(w); + return w; } #endif @@ -60,8 +60,6 @@ xf86CARD64ReverseBits(CARD64 w) #endif /* BITMAP_SCANLINE_PAD == 64 */ - - static unsigned char* RealizeCursorInterleave0(xf86CursorInfoPtr, CursorPtr); static unsigned char* RealizeCursorInterleave1(xf86CursorInfoPtr, CursorPtr); static unsigned char* RealizeCursorInterleave8(xf86CursorInfoPtr, CursorPtr); @@ -69,19 +67,18 @@ static unsigned char* RealizeCursorInterleave16(xf86CursorInfoPtr, CursorPtr); static unsigned char* RealizeCursorInterleave32(xf86CursorInfoPtr, CursorPtr); static unsigned char* RealizeCursorInterleave64(xf86CursorInfoPtr, CursorPtr); -Bool +Bool xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - - if((infoPtr->MaxWidth <= 0) || (infoPtr->MaxHeight <= 0)) + if ((infoPtr->MaxWidth <= 0) || (infoPtr->MaxHeight <= 0)) return FALSE; - if( !infoPtr->SetCursorPosition || + /* These are required for now */ + if (!infoPtr->SetCursorPosition || !infoPtr->LoadCursorImage || !infoPtr->HideCursor || !infoPtr->ShowCursor || - !infoPtr->SetCursorColors) /* these are required for now */ + !infoPtr->SetCursorColors) return FALSE; if (infoPtr->RealizeCursor) { @@ -95,48 +92,48 @@ xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr) } else if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16 & infoPtr->Flags) { infoPtr->RealizeCursor = RealizeCursorInterleave16; - } else + } else if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32 & infoPtr->Flags) { infoPtr->RealizeCursor = RealizeCursorInterleave32; - } else + } else if (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 & infoPtr->Flags) { infoPtr->RealizeCursor = RealizeCursorInterleave64; - } else { /* not interleaved */ + } else { /* not interleaved */ infoPtr->RealizeCursor = RealizeCursorInterleave0; } - infoPtr->pScrn = pScrn; + infoPtr->pScrn = xf86Screens[pScreen->myNum]; return TRUE; } - void xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) { - xf86CursorScreenPtr ScreenPriv = - (xf86CursorScreenPtr)pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = + pScreen->devPrivates[xf86CursorScreenIndex].ptr; xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr; unsigned char *bits; - if(!pCurs) { + if (pCurs == NullCursor) { (*infoPtr->HideCursor)(infoPtr->pScrn); return; } - bits = (unsigned char*)pCurs->devPriv[pScreen->myNum]; + bits = pCurs->devPriv[pScreen->myNum]; x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX; y -= infoPtr->pScrn->frameY0 + ScreenPriv->HotY; - if(!bits) { + if (!bits) { bits = (*infoPtr->RealizeCursor)(infoPtr, pCurs); - pCurs->devPriv[pScreen->myNum] = (pointer)bits; + pCurs->devPriv[pScreen->myNum] = bits; } - (*infoPtr->HideCursor)(infoPtr->pScrn); + if (!(infoPtr->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN)) + (*infoPtr->HideCursor)(infoPtr->pScrn); - if(bits) + if (bits) (*infoPtr->LoadCursorImage)(infoPtr->pScrn, bits); xf86RecolorCursor(pScreen, pCurs, 1); @@ -146,32 +143,32 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) (*infoPtr->ShowCursor)(infoPtr->pScrn); } - void xf86MoveCursor(ScreenPtr pScreen, int x, int y) { - xf86CursorScreenPtr ScreenPriv = - (xf86CursorScreenPtr)pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = + pScreen->devPrivates[xf86CursorScreenIndex].ptr; xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr; x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX; y -= infoPtr->pScrn->frameY0 + ScreenPriv->HotY; - + (*infoPtr->SetCursorPosition)(infoPtr->pScrn, x, y); } -void +void xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed) { - xf86CursorScreenPtr ScreenPriv = - (xf86CursorScreenPtr)pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = + pScreen->devPrivates[xf86CursorScreenIndex].ptr; xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr; - if(ScreenPriv->PalettedCursor) { - xColorItem sourceColor, maskColor; + if (ScreenPriv->PalettedCursor) { + xColorItem sourceColor, maskColor; ColormapPtr pmap = ScreenPriv->pInstalledMap; - if(!pmap) return; + if (!pmap) + return; sourceColor.red = pCurs->foreRed; sourceColor.green = pCurs->foreGreen; @@ -185,20 +182,20 @@ xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed) FakeFreeColor(pmap, maskColor.pixel); (*infoPtr->SetCursorColors)(infoPtr->pScrn, maskColor.pixel, sourceColor.pixel); - } else { /* Pass colors in 8-8-8 RGB format */ + } else { /* Pass colors in 8-8-8 RGB format */ (*infoPtr->SetCursorColors)(infoPtr->pScrn, - (pCurs->backBlue >> 8) | - ((pCurs->backGreen >> 8) << 8) | - ((pCurs->backRed >> 8) << 16), - (pCurs->foreBlue >> 8) | - ((pCurs->foreGreen >> 8) << 8) | - ((pCurs->foreRed >> 8) << 16) - ); + (pCurs->backBlue >> 8) | + ((pCurs->backGreen >> 8) << 8) | + ((pCurs->backRed >> 8) << 16), + (pCurs->foreBlue >> 8) | + ((pCurs->foreGreen >> 8) << 8) | + ((pCurs->foreRed >> 8) << 16) + ); } } /* These functions assume that MaxWidth is a multiple of 32 */ -static unsigned char* +static unsigned char* RealizeCursorInterleave0(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) { @@ -211,7 +208,7 @@ RealizeCursorInterleave0(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) int words = size / (CUR_BITMAP_SCANLINE_PAD / 4); - if(!(mem = xcalloc(1, size))) + if (!(mem = xcalloc(1, size))) return NULL; /* SrcPitch == the number of scanlines wide the cursor image is */ @@ -227,13 +224,13 @@ RealizeCursorInterleave0(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) DstS = (SCANLINE*)mem; DstM = DstS + words; - if(infoPtr->Flags & HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK) { + if (infoPtr->Flags & HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK) { SCANLINE *tmp; tmp = DstS; DstS = DstM; DstM = tmp; } - for(y = pCurs->bits->height, pSrc = DstS, pMsk = DstM; - y--; + for(y = pCurs->bits->height, pSrc = DstS, pMsk = DstM; + y--; pSrc+=DstPitch, pMsk+=DstPitch, SrcS+=SrcPitch, SrcM+=SrcPitch) { for(x = 0; x < Pitch; x++) { pSrc[x] = SrcS[x]; @@ -241,22 +238,22 @@ RealizeCursorInterleave0(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) } } - if(infoPtr->Flags & HARDWARE_CURSOR_AND_SOURCE_WITH_MASK) { + if (infoPtr->Flags & HARDWARE_CURSOR_AND_SOURCE_WITH_MASK) { int count = words; SCANLINE* pntr = DstS; SCANLINE* pntr2 = DstM; - while(count--) { + while (count--) { *pntr &= *pntr2; pntr++; pntr2++; } } - if(infoPtr->Flags & HARDWARE_CURSOR_NIBBLE_SWAPPED) { + if (infoPtr->Flags & HARDWARE_CURSOR_NIBBLE_SWAPPED) { int count = size; unsigned char* pntr1 = (unsigned char *)DstS; unsigned char* pntr2 = (unsigned char *)DstM; - unsigned char a,b; - while(count) { + unsigned char a, b; + while (count) { a = *pntr1; b = *pntr2; @@ -271,18 +268,18 @@ RealizeCursorInterleave0(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) * Must be _after_ HARDWARE_CURSOR_AND_SOURCE_WITH_MASK to avoid wiping * out entire source mask. */ - if(infoPtr->Flags & HARDWARE_CURSOR_INVERT_MASK) { + if (infoPtr->Flags & HARDWARE_CURSOR_INVERT_MASK) { int count = words; SCANLINE* pntr = DstM; - while(count--) { + while (count--) { *pntr = ~(*pntr); pntr++; } } - if(infoPtr->Flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) { - for(y = pCurs->bits->height, pSrc = DstS, pMsk = DstM; - y--; + if (infoPtr->Flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) { + for(y = pCurs->bits->height, pSrc = DstS, pMsk = DstM; + y--; pSrc+=DstPitch, pMsk+=DstPitch) { for(x = 0; x < Pitch; x++) { pSrc[x] = REVERSE_BIT_ORDER(pSrc[x]); @@ -294,7 +291,7 @@ RealizeCursorInterleave0(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) return mem; } -static unsigned char* +static unsigned char* RealizeCursorInterleave1(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) { unsigned char *DstS, *DstM; @@ -307,17 +304,17 @@ RealizeCursorInterleave1(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs))) return NULL; - if(!(mem = xcalloc(1, size))) { - xfree(mem2); + if (!(mem = xcalloc(1, size))) { + xfree(mem2); return NULL; } - + /* 1 bit interleave */ - DstS = (unsigned char *)mem2; + DstS = mem2; DstM = DstS + (size >> 1); - pntr = (unsigned char *)mem; + pntr = mem; count = size; - while(count) { + while (count) { *pntr++ = ((*DstS&0x01) ) | ((*DstM&0x01) << 1) | ((*DstS&0x02) << 1) | ((*DstM&0x02) << 2) | ((*DstS&0x04) << 2) | ((*DstM&0x04) << 3) | @@ -337,7 +334,7 @@ RealizeCursorInterleave1(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) return mem; } -static unsigned char* +static unsigned char* RealizeCursorInterleave8(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) { unsigned char *DstS, *DstM; @@ -350,17 +347,17 @@ RealizeCursorInterleave8(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs))) return NULL; - if(!(mem = xcalloc(1, size))) { - xfree(mem2); + if (!(mem = xcalloc(1, size))) { + xfree(mem2); return NULL; } - + /* 8 bit interleave */ - DstS = (unsigned char *)mem2; + DstS = mem2; DstM = DstS + (size >> 1); - pntr = (unsigned char *)mem; + pntr = mem; count = size; - while(count) { + while (count) { *pntr++ = *DstS++; *pntr++ = *DstM++; count-=2; @@ -372,7 +369,7 @@ RealizeCursorInterleave8(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) return mem; } -static unsigned char* +static unsigned char* RealizeCursorInterleave16(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) { unsigned short *DstS, *DstM; @@ -385,17 +382,17 @@ RealizeCursorInterleave16(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs))) return NULL; - if(!(mem = xcalloc(1, size))) { - xfree(mem2); + if (!(mem = xcalloc(1, size))) { + xfree(mem2); return NULL; } - + /* 16 bit interleave */ - DstS = (unsigned short *)mem2; + DstS = (pointer)mem2; DstM = DstS + (size >> 2); - pntr = (unsigned short *)mem; + pntr = (pointer)mem; count = (size >> 1); - while(count) { + while (count) { *pntr++ = *DstS++; *pntr++ = *DstM++; count-=2; @@ -407,7 +404,7 @@ RealizeCursorInterleave16(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) return mem; } -static unsigned char* +static unsigned char* RealizeCursorInterleave32(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) { CARD32 *DstS, *DstM; @@ -420,17 +417,17 @@ RealizeCursorInterleave32(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs))) return NULL; - if(!(mem = xcalloc(1, size))) { - xfree(mem2); + if (!(mem = xcalloc(1, size))) { + xfree(mem2); return NULL; } - + /* 32 bit interleave */ - DstS = (CARD32*)mem2; + DstS = (pointer)mem2; DstM = DstS + (size >> 3); - pntr = (CARD32*)mem; + pntr = (pointer)mem; count = (size >> 2); - while(count) { + while (count) { *pntr++ = *DstS++; *pntr++ = *DstM++; count-=2; @@ -442,7 +439,7 @@ RealizeCursorInterleave32(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) return mem; } -static unsigned char* +static unsigned char* RealizeCursorInterleave64(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) { CARD32 *DstS, *DstM; @@ -455,17 +452,17 @@ RealizeCursorInterleave64(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs))) return NULL; - if(!(mem = xcalloc(1, size))) { - xfree(mem2); + if (!(mem = xcalloc(1, size))) { + xfree(mem2); return NULL; } /* 64 bit interleave */ - DstS = (CARD32*)mem2; + DstS = (pointer)mem2; DstM = DstS + (size >> 3); - pntr = (CARD32*)mem; + pntr = (pointer)mem; count = (size >> 2); - while(count) { + while (count) { *pntr++ = *DstS++; *pntr++ = *DstS++; *pntr++ = *DstM++; diff --git a/xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c b/xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c index 76441bfd6..01710212f 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.9 2001/02/04 03:19:28 mvojkovi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c,v 1.12 2001/04/21 23:32:56 mvojkovi Exp $ * * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * @@ -44,7 +44,7 @@ #include "xf86fbman.h" #include "servermd.h" -static Bool +Bool XAAGetPixelFromRGBA ( CARD32 *pixel, CARD16 red, @@ -87,7 +87,7 @@ XAAGetPixelFromRGBA ( } -static Bool +Bool XAAGetRGBAFromPixel( CARD32 pixel, CARD16 *red, @@ -194,11 +194,18 @@ XAADoComposite ( BoxPtr pbox; int nbox; + if(!REGION_NUM_RECTS(pDst->pCompositeClip)) + return TRUE; + if(!infoRec->pScrn->vtSema || ((pDst->pDrawable->type != DRAWABLE_WINDOW) && !IS_OFFSCREEN_PIXMAP(pDst->pDrawable))) return FALSE; - + + if((pSrc->pDrawable->type != DRAWABLE_PIXMAP) || + IS_OFFSCREEN_PIXMAP(pSrc->pDrawable)) + return FALSE; + xDst += pDst->pDrawable->x; yDst += pDst->pDrawable->y; xSrc += pSrc->pDrawable->x; @@ -423,11 +430,18 @@ XAADoGlyphs (CARD8 op, ScreenPtr pScreen = pDst->pDrawable->pScreen; XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); + if(!REGION_NUM_RECTS(pDst->pCompositeClip)) + return TRUE; + if(!infoRec->pScrn->vtSema || ((pDst->pDrawable->type != DRAWABLE_WINDOW) && !IS_OFFSCREEN_PIXMAP(pDst->pDrawable))) return FALSE; + if((pSrc->pDrawable->type != DRAWABLE_PIXMAP) || + IS_OFFSCREEN_PIXMAP(pSrc->pDrawable)) + return FALSE; + if(maskFormat && (maskFormat->depth == 1) && (pSrc->pDrawable->width == 1) && (pSrc->pDrawable->height == 1) && (op == PictOpOver) && infoRec->WriteBitmap && diff --git a/xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h b/xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h index d45b371cd..ab5c36232 100644 --- a/xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h +++ b/xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h,v 1.33 2001/02/04 03:19:28 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h,v 1.34 2001/04/15 23:16:01 mvojkovi Exp $ */ #ifndef _XAALOCAL_H #define _XAALOCAL_H @@ -1594,6 +1594,27 @@ XAA_888_plus_PICT_a8_to_8888 ( int height ); +Bool +XAAGetRGBAFromPixel( + CARD32 pixel, + CARD16 *red, + CARD16 *green, + CARD16 *blue, + CARD16 *alpha, + CARD32 format +); + + +Bool +XAAGetPixelFromRGBA ( + CARD32 *pixel, + CARD16 red, + CARD16 green, + CARD16 blue, + CARD16 alpha, + CARD32 format +); + #endif diff --git a/xc/programs/Xserver/hw/xfree86/xf86Version.h b/xc/programs/Xserver/hw/xfree86/xf86Version.h index 8298cb727..03a02c070 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86Version.h +++ b/xc/programs/Xserver/hw/xfree86/xf86Version.h @@ -1,11 +1,11 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.467 2001/04/06 16:51:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.470 2001/04/26 16:23:12 dawes Exp $ */ #ifndef XF86_VERSION_CURRENT #define XF86_VERSION_MAJOR 4 #define XF86_VERSION_MINOR 0 #define XF86_VERSION_PATCH 99 -#define XF86_VERSION_SNAP 2 +#define XF86_VERSION_SNAP 3 /* This has five arguments for compatibilty reasons */ #define XF86_VERSION_NUMERIC(major,minor,patch,snap,dummy) \ @@ -24,7 +24,7 @@ 0) -#define XF86_DATE "6 April 2001" +#define XF86_DATE "26 April 2001" #endif diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile b/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile index 43134fcc2..7be07bcc7 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.17 2001/03/02 22:39:27 paulo Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.18 2001/04/22 08:36:31 herrb Exp $ XCOMM CDEBUGFLAGS=-g -Wall -ansi -pedantic @@ -100,7 +100,7 @@ XF86CONFIGDIR = XConfigDir DEFINES = -DXF86CONFIG=\"$(XF86CONFIGFILE)\" $(MODULEDEFINES) \ $(CURSESDEFINES) -DPROJECT_ROOT=\"$(PROJECTROOT)\" \ - -DXF86CONFIGDIR=\"$(XF86CONFIGDIR)\" + -DXF86CONFIGDIR=\"$(XF86CONFIGDIR)\" XFree86ConsoleDefines #if HasDlopen DLLIB = DlLibrary diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c index d7d2f3c61..d5839d93b 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c,v 1.6 2001/03/24 01:17:21 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c,v 1.7 2001/04/22 08:36:31 herrb Exp $ */ #include "xf86config.h" @@ -52,6 +52,9 @@ static Bool MouseConfigCheck(void); * Initialization */ static char *protocols[] = { +#ifdef WSCONS_SUPPORT + "wsmouse", +#endif "Auto", "BusMouse", "GlidePoint", @@ -302,6 +305,9 @@ MouseDeviceAndProtocol(XF86SetupInfo *info) static Widget mouse_dp, listD, listP, emul3, apply; static char **devices; static char *patterns[] = { +#ifdef WSCONS_SUPPORT + "wsmouse", +#endif "cua", "mouse", "ps", diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c index d387af8e8..bf50a62b2 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c +++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c,v 1.9 2001/03/01 20:37:25 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c,v 1.10 2001/04/22 08:36:31 herrb Exp $ */ #include <stdio.h> @@ -338,6 +338,9 @@ static char *protocols[] = { "MouseSystems", "SysMouse", "ThinkingMouse", +#ifdef WSCONS_SUPPORT + "wsmouse", +#endif }; static int @@ -496,7 +499,11 @@ MouseConfig(void) if (option) str = option->opt_val; if (str == NULL) +#ifdef WSCONS_SUPPORT + str = "/dev/wsmouse"; +#else str = "/dev/mouse"; +#endif ClearScreen(); refresh(); diff --git a/xc/programs/Xserver/hw/xfree86/xf86config/Imakefile b/xc/programs/Xserver/hw/xfree86/xf86config/Imakefile index 467cbcadb..f2af3f2e1 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86config/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/xf86config/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Imakefile,v 3.10 2001/01/24 00:06:40 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Imakefile,v 3.13 2001/04/23 17:15:57 dawes Exp $ @@ -11,8 +11,14 @@ XCOMM $XConsortium: Imakefile /main/5 1996/02/21 18:12:46 kaleb $ LOCAL_LIBRARIES = $(XKBFILELIB) $(XLIB) DEPLIBS = CARDDBFILE = $(LIBDIR)/Cards + +XCONFIGFILE = XConfigFile +XVERS = XFree86Version + DEFINES = -DCARD_DATABASE_FILE='"$(CARDDBFILE)"' \ - -DXKB_RULES_DIR=\"$(LIBDIR)/xkb/rules\" + -DXKB_RULES_DIR=\"$(LIBDIR)/xkb/rules\" \ + -DXCONFIGFILE=\"$(XCONFIGFILE)\" \ + -DXVERSION="$(XVERS)" XFree86ConsoleDefines #if !defined(OS2Architecture) AllTarget(ProgramTargetName(xf86config)) diff --git a/xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c b/xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c index 485ed0756..ba7df2289 100644 --- a/xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c +++ b/xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c,v 3.55 2000/12/03 19:46:18 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c,v 3.57 2001/04/23 17:15:58 dawes Exp $ */ /* * This is a configuration program that will create a base XF86Config @@ -100,7 +100,7 @@ * have been added since XFree86 3.1 (e.g. DoubleScan modes). * or to 311 to remove certain new modelines */ -#define XFREE86_VERSION 399 +#define XFREE86_VERSION 400 /* * This is the filename of the temporary XF86Config file that is written @@ -147,18 +147,38 @@ /* some more vars to make path names in texts more flexible. OS/2 users * may be more irritated than Unix users */ +#ifndef PROJECTROOT +#define PROJECTROOT "/usr/X11R6" +#endif #ifndef __EMX__ -#define TREEROOT "/usr/X11R6" -#define TREEROOTLX "/usr/X11R6/lib/X11" -#define TREEROOTCFG "/usr/X11R6/etc/X11" -#define MODULEPATH "/usr/X11R6/lib/modules" +#define TREEROOT PROJECTROOT +#define TREEROOTLX TREEROOT "/lib/X11" +#define TREEROOTCFG TREEROOT "/etc/X11" +#define MODULEPATH TREEROOT "/lib/modules" #else -#define TREEROOT "/XFree86" -#define TREEROOTLX "/XFree86/lib/X11" -#define TREEROOTCFG "/XFree86/lib/X11" -#define MODULEPATH "/XFree86/lib/modules" +#define TREEROOT "/XFree86" +#define TREEROOTLX TREEROOT "/lib/X11" +#define TREEROOTCFG TREEROOT "/lib/X11" +#define MODULEPATH TREEROOT "/lib/modules" +#endif + +#ifndef XCONFIGFILE +#define XCONFIGFILE "XF86Config" +#endif +#define CONFIGNAME XCONFIGFILE + +#ifndef XF86_VERSION_MAJOR +#ifdef XVERSION +#if XVERSION > 40000000 +#define XF86_VERSION_MAJOR (XVERSION / 10000000) +#else +#define XF86_VERSION_MAJOR (XVERSION / 1000) +#endif +#else +#define XF86_VERSION_MAJOR 4 +#endif #endif -#define CONFIGNAME "XF86Config" + int config_mousetype; /* Mouse. */ int config_emulate3buttons; @@ -248,7 +268,7 @@ static char *finalcomment_text = "alt and backspace simultaneously immediately exits the server (use if\n" "the monitor doesn't sync for a particular mode).\n" "\n" -"For further configuration, refer to " TREEROOTLX "/doc/README.Config.\n" +"For further configuration, refer to the " XCONFIGFILE "(5) manual page.\n" "\n"; static void * @@ -263,6 +283,15 @@ Malloc(int i) { return p; } +static char * +Strdup(const char *s){ + char *d; + + d = Malloc(strlen(s) + 1); + strcpy(d, s); + return d; +} + static void createtmpdir(void) { #ifndef __EMX__ @@ -335,7 +364,10 @@ static char *mousetype_identifier[] = { "MMHitTab", "IntelliMouse", #if defined(__EMX__) || defined(QNX4) - "OSMOUSE" + "OSMOUSE", +#endif +#ifdef WSCONS_SUPPORT + "wsmouse", #endif }; @@ -353,12 +385,18 @@ static char *mousetype_name[] = { "Logitech MouseMan (Microsoft compatible)", "MM Series", /* XXXX These descriptions should be improved. */ "MM HitTablet", - "Microsoft IntelliMouse" + "Microsoft IntelliMouse", +#ifdef WSCONS_SUPPORT + "wsmouse protocol", +#endif }; static char *mousedev_text = "Now give the full device name that the mouse is connected to, for example\n" "/dev/tty00. Just pressing enter will use the default, /dev/mouse.\n" +#ifdef WSCONS_SUPPORT +"On systems with wscons, the default is /dev/wsmouse.\n" +#endif "\n"; static char *mousecomment_text = @@ -368,6 +406,11 @@ static char *mousecomment_text = "protocol, and mice that default to 1 and require a button to be held at\n" "boot-time to select protocol 2. Some mice can be convinced to do 2 by sending\n" "a special sequence to the serial port (see the ClearDTR/ClearRTS options).\n" +#ifdef WSCONS_SUPPORT +"\n" +"If your system uses the wscons console driver, with a PS/2 type mouse, select\n" +"10.\n" +#endif "\n"; static char *twobuttonmousecomment_text = @@ -410,7 +453,7 @@ mouse_configuration(void) { char s[80]; printf("%s", mouseintro_text); - for (i = 0; i < 9; i++) + for (i = 0; i < sizeof(mousetype_name)/sizeof(char *); i++) printf("%2d. %s\n", i + 1, mousetype_name[i]); printf("\n"); @@ -497,7 +540,11 @@ mouse_configuration(void) { printf("Mouse device: "); getstring(s); if (strlen(s) == 0) +#ifndef WSCONS_SUPPORT config_pointerdevice = "/dev/mouse"; +#else + config_pointerdevice = "/dev/wsmouse"; +#endif else { config_pointerdevice = Malloc(strlen(s) + 1); strcpy(config_pointerdevice, s); @@ -2477,6 +2524,23 @@ write_XF86Config(char *filename) fclose(f); } +static char * +append_version(char *name) +{ +#ifdef APPEND_VERSION_TO_CONFIG_NAME + char *ret = NULL; + + if (XF86_VERSION_MAJOR > 9 || XF86_VERSION_MAJOR < 0) + return name; + + ret = Malloc(strlen(name) + 2 + 1); + sprintf(ret, "%s-%d", name, XF86_VERSION_MAJOR); + free(name); + return ret; +#else + return name; +#endif +} /* * Ask where to write XF86Config to. Returns filename. @@ -2485,7 +2549,7 @@ write_XF86Config(char *filename) static char * ask_XF86Config_location(void) { char s[80]; - char *filename; + char *filename = NULL; printf( "I am going to write the XF86Config file now. Make sure you don't accidently\n" @@ -2494,26 +2558,36 @@ ask_XF86Config_location(void) { #ifndef __EMX__ if (getuid() == 0) { #ifdef PREFER_XF86CONFIG_IN_ETC - printf("Shall I write it to /etc/X11/XF86Config? "); + filename = Strdup("/etc/X11/" XCONFIGFILE); + filename = append_version(filename); + printf("Shall I write it to %s? ", filename); getstring(s); printf("\n"); if (answerisyes(s)) - return "/etc/X11/XF86Config"; + return filename; #endif + if (filename) + free(filename); + filename = Strdup(TREEROOTCFG "/" XCONFIGFILE); + filename = append_version(filename); printf("Please answer the following question with either 'y' or 'n'.\n"); - printf("Shall I write it to the default location, /usr/X11R6/etc/X11/XF86Config? "); + printf("Shall I write it to the default location, %s? ", filename); getstring(s); printf("\n"); if (answerisyes(s)) - return "/usr/X11R6/etc/X11/XF86Config"; + return filename; #ifndef PREFER_XF86CONFIG_IN_ETC - printf("Shall I write it to /etc/X11/XF86Config? "); + if (filename) + free(filename); + filename = Strdup("/etc/X11/" XCONFIGFILE); + filename = append_version(filename); + printf("Shall I write it to %s? ", filename); getstring(s); printf("\n"); if (answerisyes(s)) - return "/etc/X11/XF86Config"; + return filename; #endif #else /* __EMX__ */ { @@ -2527,21 +2601,23 @@ ask_XF86Config_location(void) { #endif /* __EMX__ */ } - printf("Do you want it written to the current directory as 'XF86Config'? "); + if (filename) + free(filename); + filename = Strdup(XCONFIGFILE); + filename = append_version(filename); + printf("Do you want it written to the current directory as '%s'? ", filename); getstring(s); printf("\n"); - if (answerisyes(s)) -#ifndef __EMX__ - return "XF86Config"; -#else - return "XConfig"; -#endif + if (answerisyes(s)) { + return filename; + } printf("Please give a filename to write to: "); getstring(s); printf("\n"); - filename = Malloc(strlen(s) + 1); - strcpy(filename, s); + if (filename) + free(filename); + filename = Strdup(s); return filename; } @@ -2612,7 +2688,7 @@ path_check(void) { static void -configdir_check() +configdir_check(void) { /* /etc/X11 may not exist on some systems */ #ifndef __EMX__ diff --git a/xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbscrinit.c b/xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbscrinit.c index 6f35ae50a..ce2b8ae8f 100644 --- a/xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbscrinit.c +++ b/xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbscrinit.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbscrinit.c,v 1.10 2001/02/16 12:18:04 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbscrinit.c,v 1.11 2001/04/14 21:17:49 mvojkovi Exp $ */ #include "X.h" @@ -162,7 +162,7 @@ cfb8_32CloseScreen (int i, ScreenPtr pScreen) } static void -cfb8_32TransFunction( +cfb8_32TransFunc( ScreenPtr pScreen, int nbox, BoxPtr pbox @@ -172,6 +172,12 @@ cfb8_32TransFunction( } static Bool +cfb8_32InOverlayFunc(WindowPtr pWin) +{ + return (pWin->drawable.depth == 8); +} + +static Bool cfb8_32FinishScreenInit( ScreenPtr pScreen, pointer pbits, /* pointer to screen bitmap */ @@ -201,7 +207,7 @@ cfb8_32FinishScreenInit( pScreen->GetScreenPixmap = cfb32GetScreenPixmap; /* OK */ pScreen->SetScreenPixmap = cfb32SetScreenPixmap; /* OK */ - if (! miInitOverlay(pScreen, 8, cfb8_32TransFunction)) + if (! miInitOverlay(pScreen, cfb8_32InOverlayFunc, cfb8_32TransFunc)) return FALSE; return TRUE; diff --git a/xc/programs/Xserver/hw/xnest/Imakefile b/xc/programs/Xserver/hw/xnest/Imakefile index f34a01ea8..e39d870fc 100644 --- a/xc/programs/Xserver/hw/xnest/Imakefile +++ b/xc/programs/Xserver/hw/xnest/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ -XCOMM $XFree86: xc/programs/Xserver/hw/xnest/Imakefile,v 3.20 2001/03/03 22:57:26 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xnest/Imakefile,v 3.21 2001/04/20 15:51:21 tsi Exp $ #include <Server.tmpl> @@ -58,6 +58,7 @@ OBJS = Args.o \ INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \ -I../../mi -I../../include -I../../os \ -I$(EXTINCSRC) -I$(XINCLUDESRC) + DEFINES = $(OS_DEFINES) $(EXT_DEFINES) -UXINPUT -UMITSHM \ -UXF86VIDMODE -UXFreeXDGA -UXF86MISC -UXF86DRI -UXFree86LOADER diff --git a/xc/programs/Xserver/hw/xwin/Imakefile b/xc/programs/Xserver/hw/xwin/Imakefile index 45df5e969..dcbcc20a6 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.4 2001/04/05 20:13:49 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xwin/Imakefile,v 1.6 2001/04/25 19:44:02 tsi Exp $ #include <Server.tmpl> @@ -12,7 +12,6 @@ MMAPDEF = -DHAS_MMAP SRCSA = InitInput.c \ InitOutput.c \ stubs.c \ - miinitext.c \ wingc.c \ winpolyline.c \ winfillsp.c \ @@ -34,12 +33,13 @@ SRCSA = InitInput.c \ winshadgdi.c \ winshaddd.c \ winshadddnl.c \ - winpfbdd.c + winpfbdd.c \ + winkeybd.c \ + winmouse.c OBJSA = InitInput.o \ InitOutput.o \ stubs.o \ - miinitext.o \ wingc.o \ winpolyline.o \ winfillsp.o \ @@ -61,14 +61,16 @@ OBJSA = InitInput.o \ winshadgdi.o \ winshaddd.o \ winshadddnl.o \ - winpfbdd.o + winpfbdd.o \ + winkeybd.o \ + winmouse.o INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) -I$(SERVERSRC)/render \ -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi \ -I$(SERVERSRC)/include -I$(SERVERSRC)/os \ -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(SERVERSRC)/miext/shadow -DEFINES = ServerOSDefines $(SHMDEF) $(MMAPDEF) -UXFree86LOADER -UXF86DRI +DEFINES = $(OS_DEFINES) $(SHMDEF) $(MMAPDEF) -UXFree86LOADER -UXF86DRI #if BuildDPMS SRCSB = dpmsstubs.c @@ -79,10 +81,7 @@ SRCS = $(SRCSA) $(SRCSB) $(SRCSC) OBJS = $(OBJSA) $(OBJSB) $(OBJSC) LinkSourceFile(stubs.c,$(SERVERSRC)/Xi) -SpecialCObjectRule(InitInput,$(ICONFIGFILES),$(EXT_DEFINES)) - -LinkSourceFile(miinitext.c,$(SERVERSRC)/mi) -SpecialCObjectRule(miinitext,$(ICONFIGFILES),$(EXT_DEFINES) $(PAN_DEFINES) -DNO_HW_ONLY_EXTS -DNO_MODULE_EXTS $(EXT_MODULE_DEFINES) -UXFree86LOADER) +SpecialCObjectRule(stubs,$(ICONFIGFILES),$(EXT_DEFINES)) #if BuildDPMS LinkSourceFile(dpmsstubs.c,$(SERVERSRC)/Xext) diff --git a/xc/programs/Xserver/hw/xwin/InitInput.c b/xc/programs/Xserver/hw/xwin/InitInput.c index 6185072cf..4d008b272 100644 --- a/xc/programs/Xserver/hw/xwin/InitInput.c +++ b/xc/programs/Xserver/hw/xwin/InitInput.c @@ -22,10 +22,9 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/hw/xwin/InitInput.c,v 1.2 2001/04/05 20:13:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/InitInput.c,v 1.3 2001/04/18 17:14:06 dawes Exp $ */ #include "win.h" -#include "winkeymap.h" /* Called from dix/devices.c */ /* All of our keys generate up and down transition notifications, @@ -49,238 +48,15 @@ ProcessInputEvents (void) miPointerUpdate (); } -/* We call this function from winKeybdProc when we are - initializing the keyboard. -*/ -void -winGetKeyMappings (KeySymsPtr pKeySyms, CARD8 *pModMap) -{ - int i; - KeySym *pKeySym = g_winKeySym; - - /* MAP_LENGTH is defined in Xserver/include/input.h to be 256 */ - for (i = 0; i < MAP_LENGTH; i++) - { - pModMap[i] = NoSymbol; /* make sure it is restored */ - } - - /* Loop through all valid entries in the key symbol table */ - for (i = MIN_KEYCODE; - i < (MIN_KEYCODE + NUM_KEYCODES); - i++, pKeySym += GLYPHS_PER_KEY) - { - switch(*pKeySym) - { - case XK_Shift_L: - case XK_Shift_R: - pModMap[i] = ShiftMask; - break; - - case XK_Control_L: - case XK_Control_R: - pModMap[i] = ControlMask; - break; - - case XK_Caps_Lock: - pModMap[i] = LockMask; - break; - - case XK_Alt_L: - case XK_Alt_R: - pModMap[i] = AltMask; - break; - - case XK_Num_Lock: - pModMap[i] = NumLockMask; - break; - - case XK_Scroll_Lock: - pModMap[i] = ScrollLockMask; - break; - - /* kana support */ - case XK_Kana_Lock: - case XK_Kana_Shift: - pModMap[i] = KanaMask; - break; - - /* alternate toggle for multinational support */ - case XK_Mode_switch: - pModMap[i] = AltLangMask; - break; - } - } - - pKeySyms->map = (KeySym*)g_winKeySym; - pKeySyms->mapWidth = GLYPHS_PER_KEY; - pKeySyms->minKeyCode = MIN_KEYCODE; - pKeySyms->maxKeyCode = MAX_STD_KEYCODE; -} - -void -winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt, - pointer pCtrl, int iClass) -{ -} - -void -winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl) -{ -} - -/* See Porting Layer Definition - p. 18 - * This function is known as a DeviceProc. - */ -int -winKeybdProc (DeviceIntPtr pDeviceInt, int onoff) -{ - KeySymsRec keySyms; - CARD8 modMap[MAP_LENGTH]; - DevicePtr pDevice = (DevicePtr) pDeviceInt; - - switch (onoff) - { - case DEVICE_INIT: - winGetKeyMappings (&keySyms, modMap); - InitKeyboardDeviceStruct (pDevice, - &keySyms, - modMap, - winKeybdBell, - winKeybdCtrl); - break; - case DEVICE_ON: - pDevice->on = TRUE; - break; - - case DEVICE_CLOSE: - case DEVICE_OFF: - pDevice->on = FALSE; - break; - } - - return Success; -} - -void -winMouseCtrl (DeviceIntPtr pDevice, PtrCtrl *pCtrl) -{ -} - -/* See Porting Layer Definition - p. 18 - * This is known as a DeviceProc - */ -int -winMouseProc (DeviceIntPtr pDeviceInt, int onoff) -{ - CARD8 map[6]; - DevicePtr pDevice = (DevicePtr) pDeviceInt; - - switch (onoff) - { - case DEVICE_INIT: - map[1] = 1; - map[2] = 2; - map[3] = 3; - map[4] = 4; - map[5] = 5; - InitPointerDeviceStruct (pDevice, - map, - 5, /* Buttons 4 and 5 are mouse wheel events */ - miPointerGetMotionEvents, - winMouseCtrl, - miPointerGetMotionBufferSize ()); - break; - - case DEVICE_ON: - pDevice->on = TRUE; - break; - - case DEVICE_CLOSE: - case DEVICE_OFF: - pDevice->on = FALSE; - break; - } - return Success; -} - -static -void -winInitializeModeKeyStates (void) -{ - xEvent xCurrentEvent; - - /* Restore NumLock */ - if (GetKeyState (VK_NUMLOCK) & 0x0001) - { - xCurrentEvent.u.u.detail = MIN_KEYCODE + VK_NUMLOCK; - - /* Push the key */ - xCurrentEvent.u.u.type = KeyPress; - xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); - mieqEnqueue (&xCurrentEvent); - - /* Release the key */ - xCurrentEvent.u.u.type = KeyRelease; - xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); - mieqEnqueue (&xCurrentEvent); - } - - /* Restore CapsLock */ - if (GetKeyState (VK_CAPITAL) & 0x0001) - { - xCurrentEvent.u.u.detail = MIN_KEYCODE + VK_CAPITAL; - - /* Push the key */ - xCurrentEvent.u.u.type = KeyPress; - xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); - mieqEnqueue (&xCurrentEvent); - - /* Release the key */ - xCurrentEvent.u.u.type = KeyRelease; - xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); - mieqEnqueue (&xCurrentEvent); - } - - /* Restore ScrollLock */ - if (GetKeyState (VK_SCROLL) & 0x0001) - { - xCurrentEvent.u.u.detail = MIN_KEYCODE + VK_SCROLL; - - /* Push the key */ - xCurrentEvent.u.u.type = KeyPress; - xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); - mieqEnqueue (&xCurrentEvent); - - /* Release the key */ - xCurrentEvent.u.u.type = KeyRelease; - xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); - mieqEnqueue (&xCurrentEvent); - } - - /* Restore KanaLock */ - if (GetKeyState (VK_KANA) & 0x0001) - { - xCurrentEvent.u.u.detail = MIN_KEYCODE + VK_KANA; - - /* Push the key */ - xCurrentEvent.u.u.type = KeyPress; - xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); - mieqEnqueue (&xCurrentEvent); - - /* Release the key */ - xCurrentEvent.u.u.type = KeyRelease; - xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); - mieqEnqueue (&xCurrentEvent); - } -} - /* See Porting Layer Definition - p. 17 */ void InitInput (int argc, char *argv[]) { DeviceIntPtr pMouse, pKeyboard; - + +#if CYGDEBUG ErrorF ("InitInput ()\n"); +#endif pMouse = AddInputDevice (winMouseProc, TRUE); pKeyboard = AddInputDevice (winKeybdProc, TRUE); @@ -293,6 +69,16 @@ InitInput (int argc, char *argv[]) /* Initialize the mode key states */ winInitializeModeKeyStates (); + + /* Only open the windows message queue device once */ + if (g_fdMessageQueue == WIN_FD_INVALID) + { + /* Open a file descriptor for the Windows message queue */ + g_fdMessageQueue = open (WIN_MSG_QUEUE_FNAME, O_RDONLY); + + /* Add the message queue as a device to wait for in WaitForSomething */ + AddEnabledDevice (g_fdMessageQueue); + } } #ifdef XTESTEXT1 diff --git a/xc/programs/Xserver/hw/xwin/InitOutput.c b/xc/programs/Xserver/hw/xwin/InitOutput.c index aec6a6f11..fe098dbb9 100644 --- a/xc/programs/Xserver/hw/xwin/InitOutput.c +++ b/xc/programs/Xserver/hw/xwin/InitOutput.c @@ -22,15 +22,17 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/hw/xwin/InitOutput.c,v 1.4 2001/04/05 20:13:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/InitOutput.c,v 1.5 2001/04/18 17:14:06 dawes Exp $ */ #include "win.h" -int g_nNumScreens; -winScreenInfo g_winScreens[MAXSCREENS]; -//Bool g_fPixmapDepths[33]; -int g_nLastScreen = -1; -ColormapPtr g_cmInstalledMaps[MAXSCREENS]; +int g_nNumScreens; +winScreenInfo g_winScreens[MAXSCREENS]; +int g_nLastScreen = -1; +ColormapPtr g_cmInstalledMaps[MAXSCREENS]; +int g_fdMessageQueue = -1; +int g_winScreenPrivateIndex = -1; +unsigned long g_winGeneration = 0; static PixmapFormatRec g_PixmapFormats[] = { { 1, 1, BITMAP_SCANLINE_PAD }, @@ -43,43 +45,6 @@ static PixmapFormatRec g_PixmapFormats[] = { }; const int NUMFORMATS = sizeof (g_PixmapFormats) / sizeof (g_PixmapFormats[0]); -#if 0 -/* Set all pixmap flags to false, except 1 bit depth pixmaps */ -void -winInitializePixmapDepths (void) -{ -#if 0 - int i; -#endif - - /* We don't care what pixmaps people use, as long - as they are standard depths. - */ - g_fPixmapDepths[1] = TRUE; - g_fPixmapDepths[4] = TRUE; - g_fPixmapDepths[8] = TRUE; - g_fPixmapDepths[16] = TRUE; - g_fPixmapDepths[24] = TRUE; - g_fPixmapDepths[32] = TRUE; - -#if 0 - for (i = 2; i <= 32; i++) - { - g_fPixmapDepths[i] = FALSE; - - if (i == 16 || i == 24 || i == 32 ) - { - g_fPixmapDepths[i] = TRUE; - } - else - { - g_fPixmapDepths[i] = FALSE; - } - } -#endif -} -#endif - void winInitializeDefaultScreens (void) { @@ -105,7 +70,6 @@ winBitsPerPixel (DWORD dwDepth) if (dwDepth == 1) return 1; else if (dwDepth <= 8) return 8; else if (dwDepth <= 16) return 16; - else if (dwDepth <= 24) return 24; else return 32; } @@ -113,7 +77,19 @@ winBitsPerPixel (DWORD dwDepth) void ddxGiveUp() { +#if CYGDEBUG ErrorF ("ddxGiveUp ()\n"); +#endif + + /* Close our handle to our message queue */ + if (g_fdMessageQueue != WIN_FD_INVALID) + { + /* Close /dev/windows */ + close (g_fdMessageQueue); + + /* Set the file handle to invalid */ + g_fdMessageQueue = WIN_FD_INVALID; + } /* Tell Windows that we want to end the app */ PostQuitMessage (0); @@ -123,24 +99,26 @@ ddxGiveUp() void AbortDDX (void) { +#if CYGDEBUG ErrorF ("AbortDDX ()\n"); +#endif ddxGiveUp (); } void OsVendorInit (void) { +#if CYGDEBUG ErrorF ("OsVendorInit ()\n"); +#endif } /* See Porting Layer Definition - p. 57 */ void ddxUseMsg (void) { - ErrorF ("-screen scrn WxHxD\n"\ - "\tSet screen's width, height, bit depth\n"); - ErrorF ("-pixdepths list-of-int\n"\ - "\tSupport given pixmap depths\n"); + ErrorF ("-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"\ @@ -149,10 +127,9 @@ ddxUseMsg (void) "\tPixel value for white\n"); ErrorF ("-engine n\n"\ "\tOverride the server's detected engine type:\n"\ - "\t\tShadow FB GDI DIB\t\t1\n"\ - "\t\tShadow FB DirectDraw\t\t2\n"\ - "\t\tShadow FB DirectDraw Nonlocking\t4\n"\ - "\t\tPrimary FB DirectDraw\t\t8\n"); + "\t\tGDI blitter\t\t1\n"\ + "\t\tDirectDraw blitter\t2\n"\ + "\t\tDirectDraw4 blitter\t4\n"); ErrorF ("-fullscreen\n" "\tRun the specified server engine in fullscreen mode\n"); } @@ -167,12 +144,9 @@ ddxProcessArgument (int argc, char *argv[], int i) if (fFirstTime) { winInitializeDefaultScreens (); -#if 0 - winInitializePixmapDepths (); -#endif fFirstTime = FALSE; } - + /* Look for the '-screen n WxHxD' arugment */ @@ -211,36 +185,6 @@ ddxProcessArgument (int argc, char *argv[], int i) return 3; } -#if 0 - /* - Look for the '-pixdepths list-of-depths' argument - */ - if (strcmp (argv[i], "-pixdepths") == 0) - { - int nDepth, nReturn = 1; - - /* Display the usage message if the argument is malformed */ - if (++i >= argc) - { - UseMsg (); - return 0; - } - - while ((i < argc) && (nDepth = atoi (argv[i++])) != 0) - { - if (nDepth < 0 || nDepth > 32) - { - ErrorF ("Invalid pixmap depth %d\n", nDepth); - UseMsg (); - return 0; - } - g_fPixmapDepths[nDepth] = TRUE; - nReturn++; - } - return nReturn; - } -#endif - /* Look for the '-blackpixel n' argument */ @@ -415,7 +359,7 @@ GetTimeInMillis (void) { return GetTickCount (); } -#endif +#endif /* DDXTIME */ /* See Porting Layer Definition - p. 20 */ /* We use ddxProcessArgument, so we don't need to touch argc and argv */ @@ -424,40 +368,6 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[]) { int i; -#if 0 - int iNumFormats = 0; - - /* Initialize pixmap formats */ - - /* Flag a pixmap depth for every screen depth that we have */ - for (i = 0; i < g_nNumScreens; ++i) - { - g_fPixmapDepths[g_winScreens[i].dwDepth] = TRUE; - } - - /* Loop through all possible pixmap depths */ - for (i = 1; i <= 32; ++i) - { - /* Create a screen info format for existing pixmap depths */ - if (g_fPixmapDepths[i]) - { - /* Have we exceeded the number of allowed formats? */ - if (iNumFormats >= MAXFORMATS) - { - FatalError ("MAXFORMATS is too small for this server\n"); - } - - /* Setup a screen info format */ - screenInfo->formats[iNumFormats].depth = i; - screenInfo->formats[iNumFormats].bitsPerPixel = winBitsPerPixel (i); - screenInfo->formats[iNumFormats].scanlinePad = BITMAP_SCANLINE_PAD; - - /* Increment the number of formats */ - iNumFormats++; - } - } -#endif - /* Setup global screen info parameters */ screenInfo->imageByteOrder = IMAGE_BYTE_ORDER; screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; @@ -467,12 +377,14 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[]) /* Describe how we want common pixmap formats padded */ for (i = 0; i < NUMFORMATS; i++) - screenInfo->formats[i] = g_PixmapFormats[i]; + { + screenInfo->formats[i] = g_PixmapFormats[i]; + } /* Initialize each screen */ for (i = 0; i < g_nNumScreens; i++) { - if (-1 == AddScreen (winFinishScreenInitFB, argc, argv)) + if (-1 == AddScreen (winScreenInit, argc, argv)) { FatalError ("Couldn't add screen %d", i); } diff --git a/xc/programs/Xserver/hw/xwin/win.h b/xc/programs/Xserver/hw/xwin/win.h index 4654baf1b..691d8b908 100644 --- a/xc/programs/Xserver/hw/xwin/win.h +++ b/xc/programs/Xserver/hw/xwin/win.h @@ -30,34 +30,41 @@ * Peter Busch * Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/win.h,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/win.h,v 1.3 2001/04/19 12:56:03 alanh Exp $ */ #ifndef _WIN_H_ #define _WIN_H_ +#ifndef NO +#define NO 0 +#endif +#ifndef YES +#define YES 1 +#endif + /* Turn debug messages on or off */ -#define CYGDEBUG +#define CYGDEBUG NO /* Debugging macros */ -#ifdef CYGDEBUG +#if CYGDEBUG #define DEBUG_MSG(str) if (fDebugProcMsg == TRUE) MessageBox(NULL, str, szFunctionName, MB_OK ) #else #define DEBUG_MSG(str) #endif -#ifdef CYGDEBUG +#if CYGDEBUG #define DEBUG_FN_NAME(str) PTSTR szFunctionName = str #else #define DEBUG_FN_NAME(str) #endif -#ifdef CYGDEBUG +#if CYGDEBUG #define DEBUGVARS BOOL fDebugProcCon = FALSE, fDebugProcMsg = FALSE #else #define DEBUGVARS #endif -#ifdef CYGDEBUG +#if CYGDEBUG #define DEBUGPROC_CON fDebugProcCon = TRUE #define DEBUGPROC_MSG fDebugProcMsg = TRUE #else @@ -65,10 +72,14 @@ #define DEBUGPROC_MSG #endif +/* We use xor this macro for detecting toggle key state changes */ +#define WIN_XOR(a,b) ((!(a) && (b)) || ((a) && !(b))) + /* Constant strings */ -#define WINDOW_CLASS "cygwin/xfree86" -#define WINDOW_TITLE "Cygwin/XFree86" -#define WIN_SCR_PROP "cyg_screen_prop" +#define WINDOW_CLASS "cygwin/xfree86" +#define WINDOW_TITLE "Cygwin/XFree86" +#define WIN_SCR_PROP "cyg_screen_prop" +#define WIN_MSG_QUEUE_FNAME "/dev/windows" #define NEED_EVENTS @@ -78,7 +89,8 @@ #define WIN_DEFAULT_WHITEPIXEL 255 #define WIN_DEFAULT_BLACKPIXEL 0 #define WIN_DEFAULT_LINEBIAS 0 -#define XWD_WINDOW_NAME_LEN 60 + +#define WIN_FD_INVALID -1 #define WIN_SERVER_NONE 0x0L /* 0 */ #define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */ @@ -86,30 +98,16 @@ #define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */ #define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */ -#define AltMask Mod1Mask -#define NumLockMask Mod2Mask -#define AltLangMask Mod3Mask -#define KanaMask Mod4Mask -#define ScrollLockMask Mod5Mask - #define AltMapIndex Mod1MapIndex #define NumLockMapIndex Mod2MapIndex #define AltLangMapIndex Mod3MapIndex #define KanaMapIndex Mod4MapIndex #define ScrollLockMapIndex Mod5MapIndex -#define WIN_KEY_EXTENDED 0x01000000 - /* - * Defines for winkeymap.h + * We need symbols for the scan codes of keys. */ -#define GLYPHS_PER_KEY 4 -#define NUM_KEYCODES 278 -#define NUM_STD_KEYCODES 240 -#define MIN_KEYCODE 8 -#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1) -#define MAX_STD_KEYCODE (NUM_STD_KEYCODES + MIN_KEYCODE - 1) -#define WIN_VK_KP_RETURN 0x0e +#include "../xfree86/common/atKeynames.h" #include <sys/types.h> #include <sys/stat.h> @@ -122,7 +120,7 @@ #include <sys/mman.h> #ifndef MAP_FILE #define MAP_FILE 0 -#endif +#endif /* MAP_FILE */ #endif /* HAS_MMAP */ #include "X.h" @@ -161,11 +159,12 @@ #endif /* - * Windows headers 26Mar2001 2200 + * Windows headers */ #include "winms.h" /* Cygwin's winuser.h does not define VK_KANA as of 28Mar2001 */ +/* NOTE: Cygwin's winuser.h was fixed shortly after 28Mar2001. */ #ifndef VK_KANA #define VK_KANA 15 #endif @@ -176,21 +175,23 @@ * Typedefs for engine dependent function pointers */ -typedef Bool (*winAllocateFB)(ScreenPtr); +typedef Bool (*winAllocateFBProcPtr)(ScreenPtr); -typedef void (*winShadowUpdateProc)(ScreenPtr, PixmapPtr, RegionPtr); +typedef void (*winShadowUpdateProcPtr)(ScreenPtr, PixmapPtr, RegionPtr); -typedef void *(*winShadowWindowProc)(ScreenPtr, CARD32, CARD32, int, CARD32*); +typedef void *(*winShadowWindowProcPtr)(ScreenPtr, + CARD32, CARD32, + int, CARD32*); -typedef Bool (*winCloseScreen)(int, ScreenPtr); +typedef Bool (*winCloseScreenProcPtr)(int, ScreenPtr); -typedef Bool (*winInitVisuals)(ScreenPtr); +typedef Bool (*winInitVisualsProcPtr)(ScreenPtr); -typedef Bool (*winAdjustVideoMode)(ScreenPtr); +typedef Bool (*winAdjustVideoModeProcPtr)(ScreenPtr); -typedef void (*winCreateBoundingWindow)(ScreenPtr); +typedef void (*winCreateBoundingWindowProcPtr)(ScreenPtr); -typedef Bool (*winFinishScreenInit)(ScreenPtr, int, int, char **); +typedef Bool (*winFinishScreenInitProcPtr)(int, ScreenPtr, int, char **); /* * Privates structures @@ -277,14 +278,14 @@ typedef struct LPDIRECTDRAWCLIPPER pddcPrimary; /* Engine specific functions */ - winAllocateFB pwinAllocateFB; - winShadowUpdateProc pwinShadowUpdateProc; - winShadowWindowProc pwinShadowWindowProc; - winCloseScreen pwinCloseScreen; - winInitVisuals pwinInitVisuals; - winAdjustVideoMode pwinAdjustVideoMode; - winCreateBoundingWindow pwinCreateBoundingWindow; - winFinishScreenInit pwinFinishScreenInit; + winAllocateFBProcPtr pwinAllocateFB; + winShadowUpdateProcPtr pwinShadowUpdate; + winShadowWindowProcPtr pwinShadowWindow; + winCloseScreenProcPtr pwinCloseScreen; + winInitVisualsProcPtr pwinInitVisuals; + winAdjustVideoModeProcPtr pwinAdjustVideoMode; + winCreateBoundingWindowProcPtr pwinCreateBoundingWindow; + winFinishScreenInitProcPtr pwinFinishScreenInit; } winPrivScreenRec, *winPrivScreenPtr; extern ColormapPtr g_cmInstalledMaps[]; @@ -292,23 +293,33 @@ extern winScreenInfo g_winScreens[]; extern char *g_pcDisplay; extern miPointerScreenFuncRec g_winPointerCursorFuncs; extern DWORD g_dwEvents; +extern int g_fdMessageQueue; +extern int g_winScreenPrivateIndex; +extern unsigned long g_winGeneration; -int g_winScreenPrivateIndex; -unsigned long g_winGeneration; - -/* Screen privates macros */ +/* + * Screen privates macros + */ #define winGetScreenPriv(pScreen) ((winPrivScreenPtr) \ (pScreen)->devPrivates[g_winScreenPrivateIndex].ptr) + #define winSetScreenPriv(pScreen,v) ((pScreen)->devPrivates[g_winScreenPrivateIndex].ptr = \ (pointer) v) + #define winScreenPriv(pScreen) winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen) -/* Window privates macros */ +/* + * Window privates macros + */ #define winGetWindowPrivate(_pWin) ((winPrivWin *)\ (_pWin)->devPrivates[winWindowPrivateIndex].ptr) -/* FIXME: Windows mouse wheel macro, should go in Cygwin w32api headers */ -#define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam)) +/* + FIXME: Windows mouse wheel macro; should be in Cygwin w32api headers +*/ +#ifndef GET_WHEEL_DELTA_WPARAM +#define GET_WHEEL_DELTA_WPARAM(wparam) ((short)HIWORD (wparam)) +#endif /* GET_WHEEL_DELTA_WPARAM */ /* BEGIN DDX and DIX Function Prototypes */ @@ -329,16 +340,11 @@ winAllocatePrivates (ScreenPtr pScreen); /* * winblock.c */ -#if 0 -void -winBlockHandler (pointer pData, OSTimePtr pTimeout, pointer pRead); -#endif void -winBlockHandler (int iScreen, - pointer pBlockData, - pointer pTimeout, - pointer pReadmask); +winBlockHandler (pointer pBlockData, + OSTimePtr pptv, + pointer pReadMask); /* * winclip.c @@ -445,7 +451,7 @@ void winDestroyGCNativeGDI (GCPtr pGC); void -winChangeClipNativeGDI (GCPtr pGC, int nType, char *pValue, int nRects); +winChangeClipNativeGDI (GCPtr pGC, int nType, pointer pValue, int nRects); void winDestroyClipNativeGDI (GCPtr pGC); @@ -466,6 +472,34 @@ winGetSpansNativeGDI (DrawablePtr pDrawable, char *pDst); /* + * winkeybd.c + */ +void +winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode); + +void +winGetKeyMappings (KeySymsPtr pKeySyms, CARD8 *pModMap); + +void +winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt, + pointer pCtrl, int iClass); + +void +winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl); + +int +winKeybdProc (DeviceIntPtr pDeviceInt, int iState); + +void +winInitializeModeKeyStates (void); + +void +winStoreModeKeyStates (ScreenPtr pScreen); + +void +winRestoreModeKeyStates (ScreenPtr pScreen); + +/* * winmisc.c */ @@ -476,6 +510,19 @@ winQueryBestSizeNativeGDI (int class, unsigned short *pWidth, CARD8 winCountBits (DWORD dw); +Bool +winUpdateFBPointer (ScreenPtr pScreen, void *pbits); + +/* + * winmouse.c + */ + +void +winMouseCtrl (DeviceIntPtr pDevice, PtrCtrl *pCtrl); + +int +winMouseProc (DeviceIntPtr pDeviceInt, int iState); + /* * winpfbddd.c */ @@ -594,9 +641,9 @@ Bool winAllocateFBShadowDD (ScreenPtr pScreen); void -winShadowUpdateProcDD (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage); +winShadowUpdateDD (ScreenPtr pScreen, + PixmapPtr pShadow, + RegionPtr damage); void * winShadowSetWindowLinearDD (ScreenPtr pScreen, @@ -606,11 +653,11 @@ winShadowSetWindowLinearDD (ScreenPtr pScreen, CARD32 *pdwSize); void * -winShadowWindowProcDD (ScreenPtr pScreen, - CARD32 row, - CARD32 offset, - int mode, - CARD32 *size); +winShadowWindowDD (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size); Bool winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen); @@ -632,9 +679,9 @@ Bool winAllocateFBShadowDDNL (ScreenPtr pScreen); void -winShadowUpdateProcDDNL (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage); +winShadowUpdateDDNL (ScreenPtr pScreen, + PixmapPtr pShadow, + RegionPtr damage); void * winShadowSetWindowLinearDDNL (ScreenPtr pScreen, @@ -644,11 +691,11 @@ winShadowSetWindowLinearDDNL (ScreenPtr pScreen, CARD32 *pdwSize); void * -winShadowWindowProcDDNL (ScreenPtr pScreen, - CARD32 row, - CARD32 offset, - int mode, - CARD32 *size); +winShadowWindowDDNL (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size); Bool winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen); @@ -670,9 +717,9 @@ Bool winAllocateFBShadowGDI (ScreenPtr pScreen); void -winShadowUpdateProcGDI (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage); +winShadowUpdateGDI (ScreenPtr pScreen, + PixmapPtr pShadow, + RegionPtr damage); void * winShadowSetWindowLinearGDI (ScreenPtr pScreen, @@ -682,11 +729,11 @@ winShadowSetWindowLinearGDI (ScreenPtr pScreen, CARD32 *pdwSize); void * -winShadowWindowProcGDI (ScreenPtr pScreen, - CARD32 row, - CARD32 offset, - int mode, - CARD32 *size); +winShadowWindowGDI (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size); Bool winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen); @@ -703,16 +750,11 @@ winSetEngineFunctionsShadowGDI (ScreenPtr pScreen); /* * winwakeup.c */ -#if 0 -void -winWakeupHandler (pointer pData, int i, pointer pLastSelectMask); -#endif void -winWakeupHandler (int iScreen, - pointer pWakeupData, - unsigned long ulResult, - pointer pReadMask); +winWakeupHandler (pointer pWakeupData, + int err, + pointer pReadmask); /* * winwindow.c diff --git a/xc/programs/Xserver/hw/xwin/winallpriv.c b/xc/programs/Xserver/hw/xwin/winallpriv.c index 57d7c3e98..f0c033862 100644 --- a/xc/programs/Xserver/hw/xwin/winallpriv.c +++ b/xc/programs/Xserver/hw/xwin/winallpriv.c @@ -28,13 +28,10 @@ * Authors: Keith Packard, MIT X Consortium * Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winallpriv.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winallpriv.c,v 1.2 2001/04/18 17:14:06 dawes Exp $ */ #include "win.h" -int g_winScreenPrivateIndex = -1; -unsigned long g_winGeneration = 0; - /* See Porting Layer Definition - p. 58 */ Bool winAllocatePrivates (ScreenPtr pScreen) diff --git a/xc/programs/Xserver/hw/xwin/winblock.c b/xc/programs/Xserver/hw/xwin/winblock.c index 776ea4b67..ec2023e7b 100644 --- a/xc/programs/Xserver/hw/xwin/winblock.c +++ b/xc/programs/Xserver/hw/xwin/winblock.c @@ -27,32 +27,14 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winblock.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winblock.c,v 1.2 2001/04/18 17:14:06 dawes Exp $ */ #include "win.h" /* See Porting Layer Definition - p. 6 */ void -winBlockHandler (int iScreen, - pointer pBlockData, - pointer pTimeout, - pointer pReadmask) +winBlockHandler (pointer pBlockData, + OSTimePtr pptv, + pointer pReadMask) { - ScreenPtr pScreen = (ScreenPtr) pBlockData; - winPrivScreenPtr pScreenPriv; - winScreenInfoPtr pScreenInfo; - MSG msg; - - //ErrorF ("winBlockHandler () - pScreen: %08x\n", pScreen); - - pScreenPriv = winGetScreenPriv (pScreen); - pScreenInfo = pScreenPriv->pScreenInfo; - - //ErrorF ("winBlockHandler () - Got privates\n"); - - while (PeekMessage (&msg, pScreenPriv->hwndScreen, 0, 0, PM_REMOVE)) - { - TranslateMessage (&msg); - DispatchMessage (&msg); - } } diff --git a/xc/programs/Xserver/hw/xwin/wincmap.c b/xc/programs/Xserver/hw/xwin/wincmap.c index 747099931..b59da898d 100644 --- a/xc/programs/Xserver/hw/xwin/wincmap.c +++ b/xc/programs/Xserver/hw/xwin/wincmap.c @@ -30,7 +30,7 @@ * Peter Busch * Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/wincmap.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/wincmap.c,v 1.2 2001/04/18 17:14:06 dawes Exp $ */ #include "win.h" @@ -42,7 +42,7 @@ winListInstalledColormapsNativeGDI (ScreenPtr pScreen, Colormap *pmaps) * is always a colormap installed */ - fprintf (stderr, "\nwinListInstalledColormaps ()\n"); + ErrorF ("\nwinListInstalledColormaps ()\n"); return miListInstalledColormaps (pScreen, pmaps); } @@ -51,7 +51,7 @@ winListInstalledColormapsNativeGDI (ScreenPtr pScreen, Colormap *pmaps) void winInstallColormapNativeGDI (ColormapPtr pmap) { - fprintf (stderr, "\nwinInstallColormap ()\n"); + ErrorF ("\nwinInstallColormap ()\n"); miInstallColormap (pmap); } @@ -59,7 +59,7 @@ winInstallColormapNativeGDI (ColormapPtr pmap) void winUninstallColormapNativeGDI (ColormapPtr pmap) { - fprintf (stderr, "\nwinUninstallColormap ()\n"); + ErrorF ("\nwinUninstallColormap ()\n"); miUninstallColormap (pmap); } @@ -67,7 +67,7 @@ winUninstallColormapNativeGDI (ColormapPtr pmap) void winStoreColorsNativeGDI (ColormapPtr pmap, int ndef, xColorItem *pdefs) { - fprintf (stderr, "winStoreColors ()\n"); + ErrorF ("winStoreColors ()\n"); //miStoreColors (pmap, ndef, pdefs); } @@ -78,7 +78,7 @@ winResolveColorNativeGDI (unsigned short *pred, unsigned short *pblue, VisualPtr pVisual) { - fprintf (stderr, "\nwinResolveColor ()\n"); + ErrorF ("\nwinResolveColor ()\n"); miResolveColor (pred, pgreen, pblue, pVisual); } @@ -87,7 +87,7 @@ winResolveColorNativeGDI (unsigned short *pred, Bool winInitializeColormapNativeGDI (ColormapPtr pmap) { - fprintf (stderr, "\nwinInitializeColormap ()\n"); + ErrorF ("\nwinInitializeColormap ()\n"); return miInitializeColormap (pmap); } @@ -95,7 +95,7 @@ int winExpandDirectColorsNativeGDI (ColormapPtr pmap, int ndef, xColorItem *indefs, xColorItem *outdefs) { - fprintf (stderr, "\nwinExpandDirectColors ()\n"); + ErrorF ("\nwinExpandDirectColors ()\n"); return miExpandDirectColors (pmap, ndef, indefs, outdefs); } @@ -180,14 +180,18 @@ winCreateDefColormapNativeGDI (ScreenPtr pScreen) void winClearVisualTypes (void) { - fprintf (stderr, "\nwinClearVisualTypes ()\n"); +#if CYGDEBUG + ErrorF ("winClearVisualTypes ()\n"); +#endif miClearVisualTypes (); } Bool winSetVisualTypesNativeGDI (int nDepth, int nVisuals, int nBitsPerRGB) { - fprintf (stderr, "\nwinSetVisualTypes ()\n"); +#if CYGDEBUG + ErrorF ("winSetVisualTypes ()\n"); +#endif return miSetVisualTypes (nDepth, nVisuals, nBitsPerRGB, -1); } @@ -204,8 +208,11 @@ winInitVisualsNativeGDI (ScreenPtr pScreen) /* Exit if we could not allocate a bitmapinfo structure */ if (pbmi == NULL) - FatalError ("winInitVisuals () - Could not allocate a "\ - "bitmapinfo structure\n"); + { + ErrorF ("winInitVisuals () - Could not allocate a "\ + "bitmapinfo structure\n"); + return FALSE; + } /* Create a bitmap compatible with the primary display */ hbmp = CreateCompatibleBitmap (hdc, 1, 1); @@ -224,11 +231,13 @@ winInitVisualsNativeGDI (ScreenPtr pScreen) pbmi, 0); +#if CYGDEBUG ErrorF ("winInitVisuals () - 1st comp %08x rm %08x gm %08x bm %08x\n", pbmi->bmiHeader.biCompression, pbmih->bV4RedMask, pbmih->bV4GreenMask, pbmih->bV4BlueMask); +#endif /* Call GetDIBits again if the masks were zero and the color depth > 8 bpp */ if ((pScreenInfo->dwDepth > 8) @@ -243,11 +252,13 @@ winInitVisualsNativeGDI (ScreenPtr pScreen) 0); } +#if CYGDEBUG ErrorF ("winInitVisuals () - 2nd comp %08x rm %08x gm %08x bm %08x\n", pbmi->bmiHeader.biCompression, pbmih->bV4RedMask, pbmih->bV4GreenMask, pbmih->bV4BlueMask); +#endif /* Set default masks if masks could not be detected */ switch (pScreenInfo->dwDepth) @@ -285,11 +296,13 @@ winInitVisualsNativeGDI (ScreenPtr pScreen) break; } +#if CYGDEBUG ErrorF ("winInitVisuals () - 3rd comp %08x rm %08x gm %08x bm %08x\n", pbmi->bmiHeader.biCompression, pbmih->bV4RedMask, pbmih->bV4GreenMask, pbmih->bV4BlueMask); +#endif /* Copy the bitmasks into the screen privates, for later use */ pScreenPriv->dwRedMask = pbmih->bV4RedMask; @@ -354,7 +367,8 @@ winInitVisualsNativeGDI (ScreenPtr pScreen) pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { - FatalError ("winInitVisuals () - miSetVisualTypesAndMasks failed\n"); + ErrorF ("winInitVisuals () - miSetVisualTypesAndMasks failed\n"); + return FALSE; } break; @@ -368,9 +382,12 @@ winInitVisualsNativeGDI (ScreenPtr pScreen) pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { - FatalError ("winInitVisuals () - miSetVisualTypesAndMasks failed\n"); + ErrorF ("winInitVisuals () - miSetVisualTypesAndMasks failed\n"); + return FALSE; } +#if CYGDEBUG ErrorF ("winInitVisuals () - Returned from miSetVisualTypesAndMasks\n"); +#endif break; default: @@ -380,7 +397,9 @@ winInitVisualsNativeGDI (ScreenPtr pScreen) /* Free memory */ xfree (pbmi); +#if CYGDEBUG ErrorF ("winInitVisuals () - Returning\n"); +#endif return TRUE; } diff --git a/xc/programs/Xserver/hw/xwin/wingc.c b/xc/programs/Xserver/hw/xwin/wingc.c index bbe6131c9..7f8ae54a0 100644 --- a/xc/programs/Xserver/hw/xwin/wingc.c +++ b/xc/programs/Xserver/hw/xwin/wingc.c @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/wingc.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/wingc.c,v 1.2 2001/04/19 12:56:03 alanh Exp $ */ #include "win.h" @@ -299,7 +299,7 @@ winDestroyGCNativeGDI (GCPtr pGC) /* See Porting Layer Definition - p. 46 */ void -winChangeClipNativeGDI (GCPtr pGC, int nType, char *pValue, int nRects) +winChangeClipNativeGDI (GCPtr pGC, int nType, pointer pValue, int nRects) { } diff --git a/xc/programs/Xserver/hw/xwin/winkeybd.c b/xc/programs/Xserver/hw/xwin/winkeybd.c new file mode 100644 index 000000000..5df741748 --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winkeybd.c @@ -0,0 +1,465 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winkeybd.c,v 1.1 2001/04/18 17:14:06 dawes Exp $ */ + +#include "win.h" + +/* + * Include the standard XFree86 ASCII keymap. + * + * This header declares a static KeySym array called 'map'. + */ +#include "../xfree86/common/xf86Keymap.h" + +/* + * Translate a Windows WM_[SYS]KEY(UP/DOWN) message + * into an ASCII scan code. + * + * We do this ourselves, rather than letting Windows handle it, + * because Windows tends to munge the handling of special keys, + * like AltGr on European keyboards. + */ +void +winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode) +{ + /* Handle non-extended keys first, to setup a default scancode */ + switch (wParam) + { + case VK_PAUSE: + /* Windows give Pause the same scan code as NumLock */ + *piScanCode = KEY_Pause + MIN_KEYCODE; + break; + + default: + *piScanCode = LOBYTE (HIWORD (lParam)) + MIN_KEYCODE; + break; + } + + /* + Handle extended keys that weren't handled correctly as + non-extended keys. + */ + if (HIWORD (lParam) & KF_EXTENDED) + { + switch (wParam) + { + case VK_MENU: + /* Windows gives Alt_R the same scan code as Alt_L */ + *piScanCode = KEY_AltLang + MIN_KEYCODE; + break; + + case VK_CONTROL: + /* Windows gives Ctrl_R the same scan code as Ctrl_L */ + *piScanCode = KEY_RCtrl + MIN_KEYCODE; + break; + + case VK_SHIFT: + /* Windows gives Shift_R the same scan code as Shift_R */ + *piScanCode = KEY_ShiftR + MIN_KEYCODE; + break; + + case VK_INSERT: + /* Windows gives Insert the same scan code as KP_Insert */ + *piScanCode = KEY_Insert + MIN_KEYCODE; + break; + + case VK_DELETE: + /* Windows gives Delete the same scan code as KP_Delete */ + *piScanCode = KEY_Delete + MIN_KEYCODE; + break; + + case VK_HOME: + /* Windows gives Home the same scan code as KP_Home */ + *piScanCode = KEY_Home + MIN_KEYCODE; + break; + + case VK_END: + /* Windows gives End the same scan code as KP_End */ + *piScanCode = KEY_End + MIN_KEYCODE; + break; + + case VK_PRIOR: + /* Windows give Prior the same scan code as KP_Prior */ + *piScanCode = KEY_PgUp + MIN_KEYCODE; + break; + + case VK_NEXT: + /* Windows gives Next the same scan code as KP_Next */ + *piScanCode = KEY_PgDown + MIN_KEYCODE; + break; + + case VK_RIGHT: + /* Windows gives Right the same scan code as KP_Right */ + *piScanCode = KEY_Right + MIN_KEYCODE; + break; + + case VK_LEFT: + /* Windows gives Left the same scan code as KP_Left */ + *piScanCode = KEY_Left + MIN_KEYCODE; + break; + + case VK_UP: + /* Windows gives Up the same scan code as KP_Up */ + *piScanCode = KEY_Up + MIN_KEYCODE; + break; + + case VK_DOWN: + /* Windows gives Down the same scan code as KP_Down */ + *piScanCode = KEY_Down + MIN_KEYCODE; + break; + + case VK_RETURN: + /* Windows gives KP_Enter a messed up scan code (BackSpace?) */ + *piScanCode = KEY_KP_Enter + MIN_KEYCODE; + break; + + case VK_DIVIDE: + /* Windows gives KP_Divide a totallly messed up scan code */ + *piScanCode = KEY_KP_Divide + MIN_KEYCODE; + break; + + case VK_CANCEL: + /* Windows gives Ctrl + Pause/Break the incorrect scan code */ + *piScanCode = KEY_Break + MIN_KEYCODE; + break; + + case VK_SNAPSHOT: + /* Windows gives Print the wrong scan code */ + *piScanCode = KEY_Print + MIN_KEYCODE; + break; + } + } +} + +/* + * We call this function from winKeybdProc when we are + * initializing the keyboard. + */ +void +winGetKeyMappings (KeySymsPtr pKeySyms, CARD8 *pModMap) +{ + int i; + KeySym *pKeySym = map; + + /* MAP_LENGTH is defined in Xserver/include/input.h to be 256 */ + for (i = 0; i < MAP_LENGTH; i++) + { + pModMap[i] = NoSymbol; /* make sure it is restored */ + } + + /* Loop through all valid entries in the key symbol table */ + for (i = MIN_KEYCODE; + i < (MIN_KEYCODE + NUM_KEYCODES); + i++, pKeySym += GLYPHS_PER_KEY) + { + switch(*pKeySym) + { + case XK_Shift_L: + case XK_Shift_R: + pModMap[i] = ShiftMask; + break; + + case XK_Control_L: + case XK_Control_R: + pModMap[i] = ControlMask; + break; + + case XK_Caps_Lock: + pModMap[i] = LockMask; + break; + + case XK_Alt_L: + case XK_Alt_R: + pModMap[i] = AltMask; + break; + + case XK_Num_Lock: + pModMap[i] = NumLockMask; + break; + + case XK_Scroll_Lock: + pModMap[i] = ScrollLockMask; + break; + + /* Hirigana/Katakana toggle */ + case XK_Kana_Lock: + case XK_Kana_Shift: + pModMap[i] = KanaMask; + break; + + /* alternate toggle for multinational support */ + case XK_Mode_switch: + pModMap[i] = AltLangMask; + break; + } + } + + pKeySyms->map = (KeySym*)map; + pKeySyms->mapWidth = GLYPHS_PER_KEY; + pKeySyms->minKeyCode = MIN_KEYCODE; + pKeySyms->maxKeyCode = MAX_KEYCODE; +} + +/* Ring the keyboard bell (system speaker on PCs) */ +void +winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt, + pointer pCtrl, int iClass) +{ + +} + +/* Change some keyboard configuration parameters */ +void +winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl) +{ + +} + +/* + * See Porting Layer Definition - p. 18 + * winKeybdProc is known as a DeviceProc. + */ +int +winKeybdProc (DeviceIntPtr pDeviceInt, int iState) +{ + KeySymsRec keySyms; + CARD8 modMap[MAP_LENGTH]; + DevicePtr pDevice = (DevicePtr) pDeviceInt; + + switch (iState) + { + case DEVICE_INIT: + winGetKeyMappings (&keySyms, modMap); + InitKeyboardDeviceStruct (pDevice, + &keySyms, + modMap, + winKeybdBell, + winKeybdCtrl); + break; + case DEVICE_ON: + pDevice->on = TRUE; + break; + + case DEVICE_CLOSE: + case DEVICE_OFF: + pDevice->on = FALSE; + break; + } + + return Success; +} + +/* + * Detect current mode key states upon server startup. + * + * Simulate a press and release of any key that is currently + * toggled. + */ +void +winInitializeModeKeyStates (void) +{ + xEvent xCurrentEvent; + + /* Restore NumLock */ + if (GetKeyState (VK_NUMLOCK) & 0x0001) + { + xCurrentEvent.u.u.detail = KEY_NumLock + MIN_KEYCODE; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + /* Restore CapsLock */ + if (GetKeyState (VK_CAPITAL) & 0x0001) + { + xCurrentEvent.u.u.detail = KEY_CapsLock + MIN_KEYCODE; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + /* Restore ScrollLock */ + if (GetKeyState (VK_SCROLL) & 0x0001) + { + xCurrentEvent.u.u.detail = KEY_ScrollLock + MIN_KEYCODE; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + /* Restore KanaLock */ + if (GetKeyState (VK_KANA) & 0x0001) + { + xCurrentEvent.u.u.detail = KEY_HKTG + MIN_KEYCODE; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } +} + +/* + We have to store the last state of each mode + key before we lose the keyboard focus. +*/ +void +winStoreModeKeyStates (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + + /* Initialize all mode key states to off */ + pScreenPriv->dwModeKeyStates = 0x0L; + + pScreenPriv->dwModeKeyStates |= + (GetKeyState (VK_NUMLOCK) & 0x0001) << NumLockMapIndex; + + pScreenPriv->dwModeKeyStates |= + (GetKeyState (VK_SCROLL) & 0x0001) << ScrollLockMapIndex; + + pScreenPriv->dwModeKeyStates |= + (GetKeyState (VK_CAPITAL) & 0x0001) << LockMapIndex; + + pScreenPriv->dwModeKeyStates |= + (GetKeyState (VK_KANA) & 0x0001) << KanaMapIndex; +} + +/* + Upon regaining the keyboard focus we must + resynchronize our internal mode key states + with the actual state of the keys. +*/ +void +winRestoreModeKeyStates (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + xEvent xCurrentEvent; + ZeroMemory (&xCurrentEvent, sizeof (xCurrentEvent)); + + /* Has the key state changed? */ + if (WIN_XOR(pScreenPriv->dwModeKeyStates & NumLockMask, + GetKeyState (VK_NUMLOCK) & 0x0001)) + { + xCurrentEvent.u.u.detail = KEY_NumLock + MIN_KEYCODE; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + /* Has the key state changed? */ + if (WIN_XOR(pScreenPriv->dwModeKeyStates & LockMask, + GetKeyState (VK_CAPITAL) & 0x0001)) + { + xCurrentEvent.u.u.detail = KEY_CapsLock + MIN_KEYCODE; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + /* Has the key state changed? */ + if (WIN_XOR(pScreenPriv->dwModeKeyStates & ScrollLockMask, + GetKeyState (VK_SCROLL) & 0x0001)) + { + xCurrentEvent.u.u.detail = KEY_ScrollLock + MIN_KEYCODE; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + /* Has the key state changed? */ + if (WIN_XOR(pScreenPriv->dwModeKeyStates & KanaMask, + GetKeyState (VK_KANA) & 0x0001)) + { + xCurrentEvent.u.u.detail = KEY_HKTG + MIN_KEYCODE; + + /* Push the key */ + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the key */ + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } +} + + + diff --git a/xc/programs/Xserver/hw/xwin/winmisc.c b/xc/programs/Xserver/hw/xwin/winmisc.c index 67c5f86eb..320458d5d 100644 --- a/xc/programs/Xserver/hw/xwin/winmisc.c +++ b/xc/programs/Xserver/hw/xwin/winmisc.c @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winmisc.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winmisc.c,v 1.2 2001/04/18 17:14:06 dawes Exp $ */ #include "win.h" @@ -57,3 +57,32 @@ winCountBits (DWORD dw) return dwBits; } + +/* + * Modify the screen pixmap to point to the new framebuffer address + */ +Bool +winUpdateFBPointer (ScreenPtr pScreen, void *pbits) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Location of shadow framebuffer has changed */ + pScreenInfo->pfb = pbits; + + /* Update the screen pixmap */ + if (!(*pScreen->ModifyPixmapHeader)(pScreen->devPrivate, + pScreen->width, + pScreen->height, + pScreen->rootDepth, + BitsPerPixel (pScreen->rootDepth), + PixmapBytePad (pScreenInfo->dwStride, + pScreenInfo->dwDepth), + pScreenInfo->pfb)) + { + FatalError ("winUpdateFramebufferPointer () - Failed modifying "\ + "screen pixmap\n"); + } + + return TRUE; +} diff --git a/xc/programs/Xserver/hw/xwin/winmouse.c b/xc/programs/Xserver/hw/xwin/winmouse.c new file mode 100644 index 000000000..a75e3bb5e --- /dev/null +++ b/xc/programs/Xserver/hw/xwin/winmouse.c @@ -0,0 +1,78 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winmouse.c,v 1.1 2001/04/18 17:14:06 dawes Exp $ */ + +#include "win.h" + +void +winMouseCtrl (DeviceIntPtr pDevice, PtrCtrl *pCtrl) +{ + +} + +/* See Porting Layer Definition - p. 18 + * This is known as a DeviceProc + */ +int +winMouseProc (DeviceIntPtr pDeviceInt, int iState) +{ + CARD8 map[6]; + DevicePtr pDevice = (DevicePtr) pDeviceInt; + + switch (iState) + { + case DEVICE_INIT: + map[1] = 1; + map[2] = 2; + map[3] = 3; + map[4] = 4; + map[5] = 5; + InitPointerDeviceStruct (pDevice, + map, + 5, /* Buttons 4 and 5 are mouse wheel events */ + miPointerGetMotionEvents, + winMouseCtrl, + miPointerGetMotionBufferSize ()); + break; + + case DEVICE_ON: + pDevice->on = TRUE; + break; + + case DEVICE_CLOSE: + case DEVICE_OFF: + pDevice->on = FALSE; + break; + } + return Success; +} diff --git a/xc/programs/Xserver/hw/xwin/winms.h b/xc/programs/Xserver/hw/xwin/winms.h index bc11dda51..17454487d 100644 --- a/xc/programs/Xserver/hw/xwin/winms.h +++ b/xc/programs/Xserver/hw/xwin/winms.h @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winms.h,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winms.h,v 1.2 2001/04/18 17:14:06 dawes Exp $ */ #ifndef _WINMS_H_ #define _WINMS_H_ @@ -40,10 +40,12 @@ #define NONAMELESSUNION #define DIRECTDRAW_VERSION 0x0300 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif #include <windows.h> #include <windowsx.h> -//#include <wtypes.h> #include "obj_base.h" #include "ddraw.h" diff --git a/xc/programs/Xserver/hw/xwin/winpfbdd.c b/xc/programs/Xserver/hw/xwin/winpfbdd.c index d0f21810d..44829b448 100644 --- a/xc/programs/Xserver/hw/xwin/winpfbdd.c +++ b/xc/programs/Xserver/hw/xwin/winpfbdd.c @@ -30,7 +30,7 @@ * Peter Busch * Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winpfbdd.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winpfbdd.c,v 1.2 2001/04/18 17:14:06 dawes Exp $ */ #include "win.h" @@ -392,10 +392,10 @@ winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen) /* Set our pointers */ pScreenPriv->pwinAllocateFB = winAllocateFBPrimaryDD; - pScreenPriv->pwinShadowUpdateProc - = (winShadowUpdateProc) (void (*)())NoopDDA; - pScreenPriv->pwinShadowWindowProc - = (winShadowWindowProc) (void (*)())NoopDDA; + pScreenPriv->pwinShadowUpdate + = (winShadowUpdateProcPtr) (void (*)())NoopDDA; + pScreenPriv->pwinShadowWindow + = (winShadowWindowProcPtr) (void (*)())NoopDDA; pScreenPriv->pwinCloseScreen = winCloseScreenPrimaryDD; pScreenPriv->pwinInitVisuals = winInitVisualsPrimaryDD; pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModePrimaryDD; diff --git a/xc/programs/Xserver/hw/xwin/winscrinit.c b/xc/programs/Xserver/hw/xwin/winscrinit.c index 6d2ae20fe..b29de0ba4 100644 --- a/xc/programs/Xserver/hw/xwin/winscrinit.c +++ b/xc/programs/Xserver/hw/xwin/winscrinit.c @@ -30,7 +30,7 @@ * Peter Busch * Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winscrinit.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winscrinit.c,v 1.3 2001/04/22 19:52:36 alanh Exp $ */ #include "win.h" @@ -47,7 +47,9 @@ winCreateBoundingWindowFullScreen (ScreenPtr pScreen) HWND *phwnd = &pScreenPriv->hwndScreen; WNDCLASS wc; +#if CYGDEBUG ErrorF ("winCreateBoundingWindowFullScreen ()\n"); +#endif /* Setup our window class */ wc.style = CS_HREDRAW | CS_VREDRAW; @@ -127,10 +129,11 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) /* Get size of work area */ SystemParametersInfo (SPI_GETWORKAREA, 0, &rcWorkArea, 0); +#if CYGDEBUG ErrorF ("winCreateBoundingWindowWindowed () - WorkArea width %d height %d\n", rcWorkArea.right - rcWorkArea.left, rcWorkArea.bottom - rcWorkArea.top); - +#endif /* Adjust the window width and height for border and title bars */ iWidth += 2 * GetSystemMetrics (SM_CXFIXEDFRAME); @@ -161,9 +164,11 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) - GetSystemMetrics (SM_CYCAPTION); } +#if CYGDEBUG ErrorF ("winCreateBoundingWindowWindowed () - Adjusted width: %d "\ "height: %d\n", pScreenInfo->dwWidth, pScreenInfo->dwHeight); +#endif /* Create the window */ *phwnd = CreateWindowExA (0, // Extended styles @@ -196,16 +201,12 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) /* Attempt to bring our window to the top of the display */ BringWindowToTop (*phwnd); - - ErrorF ("winCreateBoundingWindowWindowed () - Returning\n"); - - /* Hide that Windows cursor */ - //ShowCursor (FALSE); } -/* Determine what type of screen we are initializing - and call the appropriate procedure to intiailize - that type of screen. +/* + Determine what type of screen we are initializing + and call the appropriate procedure to intiailize + that type of screen. */ Bool winScreenInit (int index, @@ -252,40 +253,17 @@ winFinishScreenInitFB (int index, ScreenPtr pScreen, int argc, char **argv) { - winScreenInfoPtr pScreenInfo = &g_winScreens[index]; - Bool fReturn = TRUE; + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + Bool fReturn = TRUE; char *pbits = NULL; - winPrivScreenPtr pScreenPriv; - - //#if 0 - /* Allocate privates for this screen */ - winAllocatePrivates (pScreen); - - /* Get a pointer to the privates structure that was allocated */ - pScreenPriv = winGetScreenPriv (pScreen); - - /* Save a pointer to this screen in the screen info structure */ - pScreenInfo->pScreen = pScreen; - - /* Save a pointer to the screen info in the screen privates structure */ - /* This allows us to get back to the screen info from a sceen pointer */ - pScreenPriv->pScreenInfo = pScreenInfo; - - /* Detect which engines are supported */ - winDetectSupportedEngines (pScreen); - - /* Determine which engine to use */ - if (!winSetEngine (pScreen)) - return FALSE; - - /* Adjust the video mode for our engine type */ - if (!(*pScreenPriv->pwinAdjustVideoMode) (pScreen)) - return FALSE; - //#endif /* Initial display parameters */ pScreenInfo->dwBPP = winBitsPerPixel (pScreenInfo->dwDepth); - ErrorF ("winScreenInit () - dwBPP: %d\n", pScreenInfo->dwBPP); + +#if CYGDEBUG + ErrorF ("winFinishScreenInitFB () - dwBPP: %d\n", pScreenInfo->dwBPP); +#endif /* Create display window */ (*pScreenPriv->pwinCreateBoundingWindow) (pScreen); @@ -301,7 +279,7 @@ winFinishScreenInitFB (int index, fReturn = (*pScreenPriv->pwinAllocateFB) (pScreen); if (!fReturn) { - ErrorF ("winScreenInit () - Could not allocate framebuffer\n"); + ErrorF ("winFinishScreenInitFB () - Could not allocate framebuffer\n"); return FALSE; } @@ -309,20 +287,14 @@ winFinishScreenInitFB (int index, fReturn = (*pScreenPriv->pwinInitVisuals) (pScreen); if (!fReturn) { - ErrorF ("winScreenInit () - winInitVisuals failed\n"); + ErrorF ("winFinishScreenInitFB () - winInitVisuals failed\n"); return FALSE; } - ErrorF ("winScreenInit () - Returned from winInitVisuals ()\n"); - -#if 0 - /* Tell the server that we are enabled */ - pScreenPriv->fEnabled = TRUE; -#endif /* Setup a local variable to point to the framebuffer */ pbits = pScreenInfo->pfb; - - ErrorF ("winScreenInit () - Calling fbScreenInit ()\n"); + + miSetPixmapDepths (); /* Initialize the fb code */ if (!fbScreenInit (pScreen, @@ -332,9 +304,9 @@ winFinishScreenInitFB (int index, pScreenInfo->dwStride, pScreenInfo->dwBPP)) { + ErrorF ("winFinishScreenInitFB () - fbScreenInit failed\n"); return FALSE; } - ErrorF ("winScreenInit () - Returned from fbScreenInit ()\n"); pScreen->GetWindowPixmap = winGetWindowPixmap; pScreen->SetWindowPixmap = winSetWindowPixmap; @@ -344,12 +316,6 @@ winFinishScreenInitFB (int index, fbPictureInit (pScreen, NULL, 0); #endif -#if 0 - /* Wrap fb's CloseScreen with our CloseScreen */ - pScreenPriv->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = pScreenPriv->pwinCloseScreen; -#endif - /* Setup the cursor routines */ miDCInitialize (pScreen, &g_winPointerCursorFuncs); @@ -357,45 +323,34 @@ winFinishScreenInitFB (int index, fReturn = fbCreateDefColormap (pScreen); if (!fReturn) { - ErrorF ("winScreenInit () - Could not create colormap\n"); + ErrorF ("winFinishScreenInitFB () - Could not create colormap\n"); return FALSE; } - /* Register our block and wakeup handlers; these procedures - process messages in our Windows message queue; specifically, - they process mouse and keyboard input. - - These procedures will be wrapped by the shadow fb block - and wakeup handlers. - */ -#if 0 - RegisterBlockAndWakeupHandlers (winBlockHandler, - winWakeupHandler, - (pointer) pScreen); -#endif - pScreen->BlockHandler = winBlockHandler; - pScreen->WakeupHandler = winWakeupHandler; - pScreen->blockData = pScreen; - pScreen->wakeupData = pScreen; - /* Initialize the shadow framebuffer layer */ if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL) { - ErrorF ("winScreenInit () - Calling shadowInit ()\n"); shadowInit (pScreen, - pScreenPriv->pwinShadowUpdateProc, - pScreenPriv->pwinShadowWindowProc); - ErrorF ("winScreenInit () - Returned from shadowInit ()\n"); + pScreenPriv->pwinShadowUpdate, + pScreenPriv->pwinShadowWindow); } + /* Register our block and wakeup handlers; these procedures + process messages in our Windows message queue; specifically, + they process mouse and keyboard input. + */ + RegisterBlockAndWakeupHandlers ((BlockHandlerProcPtr)NoopDDA, + winWakeupHandler, + pScreen); + /* Wrap either fb's or shadow's CloseScreen with our CloseScreen */ pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = pScreenPriv->pwinCloseScreen; /* See Porting Layer Definition - p. 33 */ - /* SaveScreen () has something to do with sceen savers */ + /* SaveScreen () has something to do with screen savers */ /* Our SaveScreen () does nothing */ pScreen->SaveScreen = winSaveScreen; @@ -592,7 +547,6 @@ winSetEngine (ScreenPtr pScreen) Bool winSaveScreen (ScreenPtr pScreen, int on) { - ErrorF ("winSaveScreen ()\n"); return TRUE; } @@ -831,8 +785,10 @@ winFinishScreenInitNativeGDI (int index, ErrorF ("winScreenInit () - calling winCreateDefColormap()\n"); fReturn = winCreateDefColormapNativeGDI (pScreen); +#ifdef RENDER ErrorF ("winScreenInit () - calling miPictureInit()\n"); miPictureInit (pScreen, formats, nformats); +#endif if (fReturn) { diff --git a/xc/programs/Xserver/hw/xwin/winshaddd.c b/xc/programs/Xserver/hw/xwin/winshaddd.c index 68c94e7b0..dc4bed83a 100644 --- a/xc/programs/Xserver/hw/xwin/winshaddd.c +++ b/xc/programs/Xserver/hw/xwin/winshaddd.c @@ -30,7 +30,7 @@ * Peter Busch * Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winshaddd.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winshaddd.c,v 1.2 2001/04/18 17:14:06 dawes Exp $ */ #include "win.h" @@ -50,32 +50,49 @@ winAllocateFBShadowDD (ScreenPtr pScreen) DDSURFACEDESC ddsd; DDSURFACEDESC *pddsdShadow = NULL; +#if CYGDEBUG ErrorF ("winAllocateFBShadowDD ()\n"); +#endif /* Create a clipper */ ddrval = DirectDrawCreateClipper (0, &pScreenPriv->pddcPrimary, NULL); if (FAILED (ddrval)) - FatalError ("winAllocateFBShadowDD () - Could not create clipper\n"); + { + ErrorF ("winAllocateFBShadowDD () - Could not create clipper\n"); + return FALSE; + } +#if CYGDEBUG ErrorF ("winAllocateFBShadowDD () - Created a clipper\n"); +#endif /* Attach the clipper to our display window */ ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary, 0, pScreenPriv->hwndScreen); if (FAILED (ddrval)) - FatalError ("winAllocateFBShadowDD () - Clipper not attached to window\n"); + { + ErrorF ("winAllocateFBShadowDD () - Clipper not attached to window\n"); + return FALSE; + } +#if CYGDEBUG ErrorF ("winAllocateFBShadowDD () - Attached clipper to window\n"); +#endif /* Create a DirectDraw object, store the address at lpdd */ ddrval = DirectDrawCreate (NULL, &pScreenPriv->pdd, NULL); if (ddrval != DD_OK) - FatalError ("winAllocateFBShadowDD () - Could not start DirectDraw\n"); + { + ErrorF ("winAllocateFBShadowDD () - Could not start DirectDraw\n"); + return FALSE; + } +#if CYGDEBUG ErrorF ("winAllocateFBShadowDD () - Created and initialized DD\n"); +#endif /* FIXME: If we are full screen we don't need the clipper */ if (pScreenInfo->fFullScreen) @@ -86,8 +103,11 @@ winAllocateFBShadowDD (ScreenPtr pScreen) DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); if (FAILED (ddrval)) - FatalError ("winAllocateFBShadowDDNL () - Could not set "\ - "cooperative level\n"); + { + ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ + "cooperative level\n"); + return FALSE; + } /* Change the video mode to the mode requested */ ddrval = IDirectDraw_SetDisplayMode (pScreenPriv->pdd, @@ -95,8 +115,11 @@ winAllocateFBShadowDD (ScreenPtr pScreen) pScreenInfo->dwHeight, pScreenInfo->dwDepth); if (FAILED (ddrval)) - FatalError ("winAllocateFBShadowDDNL () - Could not set "\ - "full screen display mode\n"); + { + ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ + "full screen display mode\n"); + return FALSE; + } } else { @@ -105,8 +128,11 @@ winAllocateFBShadowDD (ScreenPtr pScreen) pScreenPriv->hwndScreen, DDSCL_NORMAL); if (FAILED (ddrval)) - FatalError ("winAllocateFBShadowDDNL () - Could not set "\ - "cooperative level\n"); + { + ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ + "cooperative level\n"); + return FALSE; + } } /* Describe the primary surface */ @@ -121,17 +147,27 @@ winAllocateFBShadowDD (ScreenPtr pScreen) &pScreenPriv->pddsPrimary, NULL); if (FAILED (ddrval)) - FatalError ("winAllocateFBShadowDD () - Could not create primary "\ - "surface %08x\n", ddrval); + { + ErrorF ("winAllocateFBShadowDD () - Could not create primary "\ + "surface %08x\n", ddrval); + return FALSE; + } +#if CYGDEBUG ErrorF ("winAllocateFBShadowDD () - Created primary\n"); +#endif ddrval = IDirectDrawSurface_SetClipper (pScreenPriv->pddsPrimary, pScreenPriv->pddcPrimary); if (FAILED (ddrval)) - FatalError ("winAllocateFBShadowDD () - Primary attach clipper failed\n"); + { + ErrorF ("winAllocateFBShadowDD () - Primary attach clipper failed\n"); + return FALSE; + } +#if CYGDEBUG ErrorF ("winAllocateFBShadowDD () - Attached clipper to primary surface\n"); +#endif /* Describe the shadow surface to be created */ /* NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface, @@ -154,20 +190,30 @@ winAllocateFBShadowDD (ScreenPtr pScreen) &pScreenPriv->pddsShadow, NULL); if (ddrval != DD_OK) - FatalError ("winAllocateFBShadowDD () - Could not create shadow "\ - "surface: %08x\n", ddrval); + { + ErrorF ("winAllocateFBShadowDD () - Could not create shadow "\ + "surface: %08x\n", ddrval); + return FALSE; + } +#if CYGDEBUG ErrorF ("winAllocateFBShadowDD () - Created shadow\n"); +#endif /* Allocate a DD surface description for our screen privates */ pddsdShadow = pScreenPriv->pddsdShadow = xalloc (sizeof (DDSURFACEDESC)); if (pddsdShadow == NULL) - FatalError ("winAllocateFBShadowDD () - Could not allocate surface "\ - "description memory\n"); + { + ErrorF ("winAllocateFBShadowDD () - Could not allocate surface "\ + "description memory\n"); + return FALSE; + } ZeroMemory (pddsdShadow, sizeof (*pddsdShadow)); pddsdShadow->dwSize = sizeof (*pddsdShadow); +#if CYGDEBUG ErrorF ("winAllocateFBShadowDD () - Locking shadow\n"); +#endif /* Lock the shadow surface */ ddrval = IDirectDrawSurface_Lock (pScreenPriv->pddsShadow, @@ -176,14 +222,22 @@ winAllocateFBShadowDD (ScreenPtr pScreen) DDLOCK_WAIT, NULL); if (ddrval != DD_OK || pddsdShadow->lpSurface == NULL) - FatalError ("winAllocateFBShadowDD () - Could not lock shadow "\ - "surface: %08x\n", ddrval); + { + ErrorF ("winAllocateFBShadowDD () - Could not lock shadow "\ + "surface: %08x\n", ddrval); + return FALSE; + } +#if CYGDEBUG ErrorF ("winAllocateFBShadowDD () - Locked shadow\n"); +#endif /* We don't know how to deal with anything other than RGB */ if (!(pddsdShadow->ddpfPixelFormat.dwFlags & DDPF_RGB)) - FatalError ("winAllocateFBShadowDD () - Color format other than RGB\n"); + { + ErrorF ("winAllocateFBShadowDD () - Color format other than RGB\n"); + return FALSE; + } /* Grab the pitch, and memory pointer from the surface desc */ pScreenInfo->dwStrideBytes = pddsdShadow->u.lPitch; @@ -197,7 +251,9 @@ winAllocateFBShadowDD (ScreenPtr pScreen) pScreenPriv->dwGreenMask = pddsdShadow->ddpfPixelFormat.u3.dwGBitMask; pScreenPriv->dwBlueMask = pddsdShadow->ddpfPixelFormat.u4.dwBBitMask; +#if CYGDEBUG ErrorF ("winAllocateFBShadowDD () - Returning\n"); +#endif return TRUE; } @@ -206,9 +262,9 @@ winAllocateFBShadowDD (ScreenPtr pScreen) Transfer the damaged regions of the shadow framebuffer to the display. */ void -winShadowUpdateProcDD (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage) +winShadowUpdateDD (ScreenPtr pScreen, + PixmapPtr pShadow, + RegionPtr damage) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; @@ -229,7 +285,10 @@ winShadowUpdateProcDD (ScreenPtr pScreen, /* Unlock the shadow surface, so we can blit */ ddrval = IDirectDrawSurface_Unlock (pScreenPriv->pddsShadow, NULL); if (FAILED (ddrval)) - FatalError ("winShadowUpdateProcDD () - Unlock failed\n"); + { + ErrorF ("winShadowUpdateProcDD () - Unlock failed\n"); + return FALSE; + } /* Loop through all boxes in the damaged region */ while (dwBox--) @@ -253,8 +312,6 @@ winShadowUpdateProcDD (ScreenPtr pScreen, &rcSrc, DDBLT_WAIT, NULL); - if (FAILED (ddrval)) - FatalError ("winShadowUpateProcDD () - BltFast failed\n"); /* Get a pointer to the next box */ ++pBox; @@ -267,7 +324,10 @@ winShadowUpdateProcDD (ScreenPtr pScreen, DDLOCK_WAIT, NULL); if (FAILED (ddrval)) - FatalError ("winShadowUpdateProcDD () - Lock failed\n"); + { + ErrorF ("winShadowUpdateProcDD () - Lock failed\n"); + return FALSE; + } /* Has our memory pointer changed? */ if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface) @@ -285,7 +345,9 @@ winShadowUpdateProcDD (ScreenPtr pScreen, pScreenInfo->dwDepth), pScreenInfo->pfb)) { - FatalError ("winShadowUpdateProcDD () - Bits changed, no notify\n"); + ErrorF ("winShadowUpdateProcDD () - Bits changed, could not "\ + "notify fb.\n"); + return FALSE; } } } @@ -319,11 +381,11 @@ winShadowSetWindowLinearDD (ScreenPtr pScreen, required a different calculation. */ void * -winShadowWindowProcDD (ScreenPtr pScreen, - CARD32 row, - CARD32 offset, - int mode, - CARD32 *size) +winShadowWindowDD (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size) { return winShadowSetWindowLinearDD (pScreen, row, offset, mode, size); } @@ -340,7 +402,9 @@ winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen) winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; Bool fReturn; +#if CYGDEBUG ErrorF ("winCloseScreenShadowDD () - Freeing screen resources\n"); +#endif /* Flag that the screen is closed */ pScreenPriv->fClosed = TRUE; @@ -447,7 +511,9 @@ winInitVisualsShadowDD (ScreenPtr pScreen) pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { - FatalError ("winInitVisualsShadowDD () - miSetVisualTypesAndMasks failed\n"); + ErrorF ("winInitVisualsShadowDD () - miSetVisualTypesAndMasks "\ + "failed\n"); + return FALSE; } break; @@ -461,7 +527,9 @@ winInitVisualsShadowDD (ScreenPtr pScreen) pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { - FatalError ("winInitVisualsShadowDD () - miSetVisualTypesAndMasks failed\n"); + ErrorF ("winInitVisualsShadowDD () - miSetVisualTypesAndMasks "\ + "failed\n"); + return FALSE; } ErrorF ("winInitVisualsShadowDD () - Returned from miSetVisualTypesAndMasks\n"); break; @@ -527,8 +595,8 @@ winSetEngineFunctionsShadowDD (ScreenPtr pScreen) /* Set our pointers */ pScreenPriv->pwinAllocateFB = winAllocateFBShadowDD; - pScreenPriv->pwinShadowUpdateProc = winShadowUpdateProcDD; - pScreenPriv->pwinShadowWindowProc = winShadowWindowProcDD; + pScreenPriv->pwinShadowUpdate = winShadowUpdateDD; + pScreenPriv->pwinShadowWindow = winShadowWindowDD; pScreenPriv->pwinCloseScreen = winCloseScreenShadowDD; pScreenPriv->pwinInitVisuals = winInitVisualsShadowDD; pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDD; diff --git a/xc/programs/Xserver/hw/xwin/winshadddnl.c b/xc/programs/Xserver/hw/xwin/winshadddnl.c index c42ff0afd..d78074654 100644 --- a/xc/programs/Xserver/hw/xwin/winshadddnl.c +++ b/xc/programs/Xserver/hw/xwin/winshadddnl.c @@ -30,7 +30,7 @@ * Peter Busch * Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winshadddnl.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winshadddnl.c,v 1.2 2001/04/18 17:14:06 dawes Exp $ */ #include "win.h" @@ -67,8 +67,10 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen) char *lpSurface = NULL; DDPIXELFORMAT ddpfPrimary; +#if CYGDEBUG ErrorF ("winAllocateFBShadowDDNL () - w %d h %d d %d\n", pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwDepth); +#endif /* Allocate memory for our shadow surface */ lpSurface = xalloc (pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight); @@ -85,36 +87,54 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen) &pScreenPriv->pddcPrimary, NULL); if (FAILED (ddrval)) - FatalError ("winAllocateFBShadowDDNL () - Could not create clipper\n"); + { + ErrorF ("winAllocateFBShadowDDNL () - Could not attach clipper\n"); + return FALSE; + } +#if CYGDEBUG ErrorF ("winAllocateFBShadowDDNL () - Created a clipper\n"); +#endif /* Attach the clipper to our display window */ ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary, 0, pScreenPriv->hwndScreen); if (FAILED (ddrval)) - FatalError ("winAllocateFBShadowDDNL () - Clipper not attached "\ - "to window\n"); + { + ErrorF ("winAllocateFBShadowDDNL () - Clipper not attached "\ + "to window\n"); + return FALSE; + } +#if CYGDEBUG ErrorF ("winAllocateFBShadowDDNL () - Attached clipper to window\n"); +#endif /* Create a DirectDraw object, store the address at lpdd */ ddrval = DirectDrawCreate (NULL, (void**) &pScreenPriv->pdd, NULL); if (ddrval != DD_OK) - FatalError ("winAllocateFBShadowDDNL () - Could not start DirectDraw\n"); + { + ErrorF ("winAllocateFBShadowDDNL () - Could not start DirectDraw\n"); + return FALSE; + } +#if CYGDEBUG ErrorF ("winAllocateFBShadowDDNL () - Created and initialized DD\n"); +#endif /* Get a DirectDraw4 interface pointer */ ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd, &IID_IDirectDraw4, (LPVOID*) &pScreenPriv->pdd4); if (FAILED (ddrval)) - FatalError ("winAllocateFBShadowDDNL () - Failed DD4 query: %08x\n", - ddrval); + { + ErrorF ("winAllocateFBShadowDDNL () - Failed DD4 query: %08x\n", + ddrval); + return FALSE; + } /* Are we full screen? */ /* FIXME: If we are full screen we don't need the clipper */ @@ -126,8 +146,11 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen) DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); if (FAILED (ddrval)) - FatalError ("winAllocateFBShadowDDNL () - Could not set "\ - "cooperative level\n"); + { + ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ + "cooperative level\n"); + return FALSE; + } /* Change the video mode to the mode requested */ ddrval = IDirectDraw_SetDisplayMode (pScreenPriv->pdd, @@ -135,8 +158,11 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen) pScreenInfo->dwHeight, pScreenInfo->dwDepth); if (FAILED (ddrval)) - FatalError ("winAllocateFBShadowDDNL () - Could not set "\ - "full screen display mode\n"); + { + ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ + "full screen display mode\n"); + return FALSE; + } } else { @@ -145,8 +171,11 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen) pScreenPriv->hwndScreen, DDSCL_NORMAL); if (FAILED (ddrval)) - FatalError ("winAllocateFBShadowDDNL () - Could not set "\ - "cooperative level\n"); + { + ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ + "cooperative level\n"); + return FALSE; + } } /* Describe the primary surface */ @@ -161,35 +190,50 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen) &pScreenPriv->pddsPrimary4, NULL); if (FAILED (ddrval)) - FatalError ("winAllocateFBShadowDDNL () - Could not create primary "\ - "surface %08x\n", ddrval); + { + ErrorF ("winAllocateFBShadowDDNL () - Could not create primary "\ + "surface %08x\n", ddrval); + return FALSE; + } +#if CYGDEBUG ErrorF ("winAllocateFBShadowDDNL () - Created primary\n"); +#endif ZeroMemory (&ddpfPrimary, sizeof (ddpfPrimary)); ddpfPrimary.dwSize = sizeof (ddpfPrimary); ddrval = IDirectDrawSurface_GetPixelFormat (pScreenPriv->pddsPrimary4, &ddpfPrimary); if (FAILED (ddrval)) - FatalError ("winAllocateFBShadowDDNL () - Could not get primary "\ - "pixformat\n"); + { + ErrorF ("winAllocateFBShadowDDNL () - Could not get primary "\ + "pixformat\n"); + return FALSE; + } +#if CYGDEBUG ErrorF ("winAllocateFBShadowDDNL () - Primary masks: %08x %08x %08x "\ "dwRGBBitCount: %d\n", ddpfPrimary.u2.dwRBitMask, ddpfPrimary.u3.dwGBitMask, ddpfPrimary.u4.dwBBitMask, ddpfPrimary.u.dwRGBBitCount); +#endif /* Attach our clipper to our primary surface handle */ ddrval = IDirectDrawSurface_SetClipper (pScreenPriv->pddsPrimary4, pScreenPriv->pddcPrimary); if (FAILED (ddrval)) - FatalError ("winAllocateFBShadowDDNL () - Primary attach clipper "\ - "failed\n"); + { + ErrorF ("winAllocateFBShadowDDNL () - Primary attach clipper "\ + "failed\n"); + return FALSE; + } +#if CYGDEBUG ErrorF ("winAllocateFBShadowDDNL () - Attached clipper to primary "\ "surface\n"); +#endif /* Describe the shadow surface to be created */ /* NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface, @@ -216,11 +260,16 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen) &pScreenPriv->pddsShadow4, NULL); if (ddrval != DD_OK) - FatalError ("winAllocateFBShadowDDNL () - Could not create shadow "\ - "surface %08x\n", ddrval); + { + ErrorF ("winAllocateFBShadowDDNL () - Could not create shadow "\ + "surface %08x\n", ddrval); + return FALSE; + } +#if CYGDEBUG ErrorF ("winAllocateFBShadowDDNL () - Created shadow pitch: %d\n", ddsdShadow.u.lPitch); +#endif /* Grab the pitch, and memory pointer from the surface desc */ pScreenInfo->dwStrideBytes = pScreenInfo->dwPaddedWidth; @@ -234,7 +283,9 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen) pScreenPriv->dwGreenMask = ddsdShadow.ddpfPixelFormat.u3.dwGBitMask; pScreenPriv->dwBlueMask = ddsdShadow.ddpfPixelFormat.u4.dwBBitMask; +#if CYGDEBUG ErrorF ("winAllocateFBShadowDDNL () - Returning\n"); +#endif return TRUE; } @@ -243,9 +294,9 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen) Transfer the damaged regions of the shadow framebuffer to the display. */ void -winShadowUpdateProcDDNL (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage) +winShadowUpdateDDNL (ScreenPtr pScreen, + PixmapPtr pShadow, + RegionPtr damage) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; @@ -285,8 +336,6 @@ winShadowUpdateProcDDNL (ScreenPtr pScreen, &rcSrc, DDBLT_WAIT, NULL); - if (FAILED (ddrval)) - FatalError ("winShadowUpateProcDDNL () - Blt failed\n"); /* Get a pointer to the next box */ ++pBox; @@ -323,14 +372,14 @@ winShadowSetWindowLinearDDNL (ScreenPtr pScreen, required a different calculation. */ void * -winShadowWindowProcDDNL (ScreenPtr pScreen, - CARD32 row, - CARD32 offset, - int mode, - CARD32 *size) +winShadowWindowDDNL (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size) { FatalError ("winShadowWindowProcDDNL () - Hmm... this function has never "\ - "been called. Please send a message to "\ + "been called before. Please send a message to "\ "cygwin-xfree@cygwin.com if you get this message.\n"); return winShadowSetWindowLinearDDNL (pScreen, row, offset, mode, size); } @@ -346,8 +395,10 @@ winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen) winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; Bool fReturn; - + +#if CYGDEBUG ErrorF ("winCloseScreenShadowDDNL () - Freeing screen resources\n"); +#endif /* Flag that the screen is closed */ pScreenPriv->fClosed = TRUE; @@ -437,7 +488,7 @@ winInitVisualsShadowDDNL (ScreenPtr pScreen) pScreenPriv->dwBitsPerRGB = dwGreenBits; else pScreenPriv->dwBitsPerRGB = dwBlueBits; - + ErrorF ("winInitVisualsShadowDDNL () - Masks %08x %08x %08x RGB %d d %d\n", pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, @@ -460,8 +511,9 @@ winInitVisualsShadowDDNL (ScreenPtr pScreen) pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { - FatalError ("winInitVisualsShadowDDNL () - "\ - "miSetVisualTypesAndMasks failed\n"); + ErrorF ("winInitVisualsShadowDDNL () - "\ + "miSetVisualTypesAndMasks failed\n"); + return FALSE; } break; @@ -476,11 +528,10 @@ winInitVisualsShadowDDNL (ScreenPtr pScreen) pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { - FatalError ("winInitVisualsShadowDDNL () - "\ - "miSetVisualTypesAndMasks failed\n"); + ErrorF ("winInitVisualsShadowDDNL () - "\ + "miSetVisualTypesAndMasks failed\n"); + return FALSE; } - ErrorF ("winInitVisualsShadowDDNL () - Returned from "\ - "miSetVisualTypesAndMasks\n"); break; default: @@ -546,8 +597,8 @@ winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen) /* Set our pointers */ pScreenPriv->pwinAllocateFB = winAllocateFBShadowDDNL; - pScreenPriv->pwinShadowUpdateProc = winShadowUpdateProcDDNL; - pScreenPriv->pwinShadowWindowProc = winShadowWindowProcDDNL; + pScreenPriv->pwinShadowUpdate = winShadowUpdateDDNL; + pScreenPriv->pwinShadowWindow = winShadowWindowDDNL; pScreenPriv->pwinCloseScreen = winCloseScreenShadowDDNL; pScreenPriv->pwinInitVisuals = winInitVisualsShadowDDNL; pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDDNL; diff --git a/xc/programs/Xserver/hw/xwin/winshadgdi.c b/xc/programs/Xserver/hw/xwin/winshadgdi.c index bf39bac94..f16ab1037 100644 --- a/xc/programs/Xserver/hw/xwin/winshadgdi.c +++ b/xc/programs/Xserver/hw/xwin/winshadgdi.c @@ -27,7 +27,7 @@ * * Authors: Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winshadgdi.c,v 1.1 2001/04/05 20:13:51 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winshadgdi.c,v 1.2 2001/04/18 17:14:06 dawes Exp $ */ #include "win.h" @@ -176,29 +176,39 @@ winAllocateFBShadowGDI (ScreenPtr pScreen) return FALSE; else { +#if CYGDEBUG ErrorF ("winAllocateFBShadowGDI () - Shadow buffer allocated\n"); +#endif } /* Get information about the bitmap that was allocated */ GetObject (pScreenPriv->hbmpShadow, sizeof (dibsection), &dibsection); - + +#if CYGDEBUG /* Print information about bitmap allocated */ ErrorF ("winAllocateFBShadowGDI () - Dibsection width: %d height: %d\n", dibsection.dsBmih.biWidth, dibsection.dsBmih.biHeight); +#endif /* Select the shadow bitmap into the shadow DC */ SelectObject (pScreenPriv->hdcShadow, pScreenPriv->hbmpShadow); +#if CYGDEBUG ErrorF ("winAllocateFBShadowGDI () - Attempting a shadow blit\n"); +#endif + BitBlt (pScreenPriv->hdcScreen, 0, 0, pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenPriv->hdcShadow, 0, 0, SRCCOPY); + +#if CYGDEBUG ErrorF ("winAllocateFBShadowGDI () - Shadow blit success\n"); +#endif /* Set screeninfo stride */ pScreenInfo->dwStrideBytes = pScreenInfo->dwPaddedWidth; @@ -210,9 +220,9 @@ winAllocateFBShadowGDI (ScreenPtr pScreen) /* Blit the damaged regions of the shadow fb to the screen */ void -winShadowUpdateProcGDI (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage) +winShadowUpdateGDI (ScreenPtr pScreen, + PixmapPtr pShadow, + RegionPtr damage) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; @@ -234,15 +244,12 @@ winShadowUpdateProcGDI (ScreenPtr pScreen, w = pBox->x2 - pBox->x1; h = pBox->y2 - pBox->y1; - if (!BitBlt (pScreenPriv->hdcScreen, - x, y, - w, h, - pScreenPriv->hdcShadow, - x, y, - SRCCOPY)) - { - FatalError ("winShadowUpdateProc () - BitBlt failed\n"); - } + BitBlt (pScreenPriv->hdcScreen, + x, y, + w, h, + pScreenPriv->hdcShadow, + x, y, + SRCCOPY); /* Get a pointer to the next box */ ++pBox; @@ -264,11 +271,11 @@ winShadowSetWindowLinearGDI (ScreenPtr pScreen, } void * -winShadowWindowProcGDI (ScreenPtr pScreen, - CARD32 dwRow, - CARD32 dwOffset, - int mode, - CARD32 *pdwSize) +winShadowWindowGDI (ScreenPtr pScreen, + CARD32 dwRow, + CARD32 dwOffset, + int mode, + CARD32 *pdwSize) { return winShadowSetWindowLinearGDI (pScreen, dwRow, dwOffset, mode, pdwSize); } @@ -284,7 +291,9 @@ winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen) winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; Bool fReturn; +#if CYGDEBUG ErrorF ("winCloseScreenShadowGDI () - Freeing screen resources\n"); +#endif /* Flag that the screen is closed */ pScreenPriv->fClosed = TRUE; @@ -334,28 +343,21 @@ winInitVisualsShadowGDI (ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - BITMAPINFOHEADER *pbmih = NULL; - Bool fReturn = TRUE; - /* Allocate bitmap info structure */ - pbmih = (BITMAPINFOHEADER*) xalloc (sizeof (BITMAPINFOHEADER) - + 256 * sizeof (RGBQUAD)); - if (pbmih == NULL) - return FALSE; - - /* Set bits per RGB and color masks */ - fReturn = winQueryRGBBitsAndMasks (pScreen); - if (!fReturn) + /* Determine our color masks */ + if (!winQueryRGBBitsAndMasks (pScreen)) { - xfree (pbmih); - return fReturn; + ErrorF ("winInitVisualsShadowGDI () - winQueryRGBBitsAndMasks failed\n"); + return FALSE; } +#if CYGDEBUG ErrorF ("winInitVisualsGDI () - Masks: %08x %08x %08x bpRGB: %d\n", pScreenPriv->dwRedMask, pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask, pScreenPriv->dwBitsPerRGB); +#endif /* Create a single visual according to the Windows screen depth */ switch (pScreenInfo->dwDepth) @@ -372,12 +374,13 @@ winInitVisualsShadowGDI (ScreenPtr pScreen) pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { - FatalError ("winInitVisualsGDI () - miSetVisualTypesAndMasks failed\n"); + ErrorF ("winInitVisualsGDI () - miSetVisualTypesAndMasks failed\n"); + return FALSE; } break; case 8: - ErrorF ("winInitVisuals () - Calling miSetVisualTypesAndMasks\n"); + ErrorF ("winInitVisualsGDI () - Calling miSetVisualTypesAndMasks\n"); if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, PseudoColorMask, pScreenPriv->dwBitsPerRGB, @@ -386,20 +389,27 @@ winInitVisualsShadowGDI (ScreenPtr pScreen) pScreenPriv->dwGreenMask, pScreenPriv->dwBlueMask)) { - FatalError ("winInitVisualsGDI () - miSetVisualTypesAndMasks failed\n"); + ErrorF ("winInitVisualsGDI () - miSetVisualTypesAndMasks failed\n"); + return FALSE; } - ErrorF ("winInitVisualsGDI () - Returned from miSetVisualTypesAndMasks\n"); break; + default: + ErrorF ("winInitVisualsGDI () - Unknown screen depth\n"); + return FALSE; } - + +#if CYGDEBUG + ErrorF ("winInitVisualsShadowGDI () - Returned from "\ + "miSetVisualTypesAndMasks\n"); +#endif + /* Set DPI info */ pScreenInfo->dwDPIx = GetDeviceCaps (pScreenPriv->hdcScreen, LOGPIXELSX); pScreenInfo->dwDPIy = GetDeviceCaps (pScreenPriv->hdcScreen, LOGPIXELSY); - /* Free memory */ - xfree (pbmih); - +#if CYGDEBUG ErrorF ("winInitVisualsGDI () - Returning\n"); +#endif return TRUE; } @@ -446,8 +456,8 @@ winSetEngineFunctionsShadowGDI (ScreenPtr pScreen) /* Set our pointers */ pScreenPriv->pwinAllocateFB = winAllocateFBShadowGDI; - pScreenPriv->pwinShadowUpdateProc = winShadowUpdateProcGDI; - pScreenPriv->pwinShadowWindowProc = winShadowWindowProcGDI; + pScreenPriv->pwinShadowUpdate = winShadowUpdateGDI; + pScreenPriv->pwinShadowWindow = winShadowWindowGDI; pScreenPriv->pwinCloseScreen = winCloseScreenShadowGDI; pScreenPriv->pwinInitVisuals = winInitVisualsShadowGDI; pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowGDI; diff --git a/xc/programs/Xserver/hw/xwin/winwakeup.c b/xc/programs/Xserver/hw/xwin/winwakeup.c index 1f5fb82bf..b026f3bcb 100644 --- a/xc/programs/Xserver/hw/xwin/winwakeup.c +++ b/xc/programs/Xserver/hw/xwin/winwakeup.c @@ -30,33 +30,23 @@ * Peter Busch * Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winwakeup.c,v 1.1 2001/04/05 20:13:51 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winwakeup.c,v 1.2 2001/04/18 17:14:07 dawes Exp $ */ #include "win.h" /* See Porting Layer Definition - p. 7 */ void -winWakeupHandler (int iScreen, - pointer pWakeupData, - unsigned long ulResult, +winWakeupHandler (pointer pWakeupData, + int err, pointer pReadmask) { - ScreenPtr pScreen = (ScreenPtr) pWakeupData; - winPrivScreenPtr pScreenPriv; - winScreenInfoPtr pScreenInfo; + winScreenPriv((ScreenPtr)pWakeupData); MSG msg; -#if 0 - ErrorF ("winWakeupHandler () - %d %08x %d %08x\n", - iScreen, pWakeupData, ulResult, pReadmask); -#endif - - pScreenPriv = winGetScreenPriv (pScreen); - pScreenInfo = pScreenPriv->pScreenInfo; - while (PeekMessage (&msg, pScreenPriv->hwndScreen, 0, 0, PM_REMOVE)) { - //TranslateMessage (&msg); DispatchMessage (&msg); } } + + diff --git a/xc/programs/Xserver/hw/xwin/winwndproc.c b/xc/programs/Xserver/hw/xwin/winwndproc.c index 0ea025530..35fb5369c 100644 --- a/xc/programs/Xserver/hw/xwin/winwndproc.c +++ b/xc/programs/Xserver/hw/xwin/winwndproc.c @@ -30,161 +30,10 @@ * Peter Busch * Harold L Hunt II */ -/* $XFree86: xc/programs/Xserver/hw/xwin/winwndproc.c,v 1.1 2001/04/05 20:13:51 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winwndproc.c,v 1.2 2001/04/18 17:14:07 dawes Exp $ */ #include "win.h" -#define WIN_XOR(a,b) ((!(a) && (b)) || ((a) && !(b))) - -/* - * Modify the screen pixmap to point to the new framebuffer address - */ -static -Bool -winUpdateFBPointer (ScreenPtr pScreen, void *pbits) -{ - winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - - /* Location of shadow framebuffer has changed */ - pScreenInfo->pfb = pbits; - - /* Update the screen pixmap */ - if (!(*pScreen->ModifyPixmapHeader)(pScreen->devPrivate, - pScreen->width, - pScreen->height, - pScreen->rootDepth, - BitsPerPixel (pScreen->rootDepth), - PixmapBytePad (pScreenInfo->dwStride, - pScreenInfo->dwDepth), - pScreenInfo->pfb)) - { - FatalError ("winUpdateFramebufferPointer () - Failed modifying "\ - "screen pixmap\n"); - } - - return TRUE; -} - -/* - We have to store the last state of each mode - key before we lose the keyboard focus. -*/ -static -void -winStoreModeKeyStates (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - - /* Initialize all mode key states to off */ - pScreenPriv->dwModeKeyStates = 0x0L; - - pScreenPriv->dwModeKeyStates |= - (GetKeyState (VK_NUMLOCK) & 0x0001) << NumLockMapIndex; - - pScreenPriv->dwModeKeyStates |= - (GetKeyState (VK_SCROLL) & 0x0001) << ScrollLockMapIndex; - - pScreenPriv->dwModeKeyStates |= - (GetKeyState (VK_CAPITAL) & 0x0001) << LockMapIndex; - - pScreenPriv->dwModeKeyStates |= - (GetKeyState (VK_KANA) & 0x0001) << KanaMapIndex; - - ErrorF ("winStoreModeKeyStates () - dwModeKeyStates: %08x\n", - pScreenPriv->dwModeKeyStates); -} - -/* - Upon regaining the keyboard focus we must - resynchronize our internal mode key states - with the actual state of the keys. -*/ -void -winRestoreModeKeyStates (ScreenPtr pScreen) -{ - winScreenPriv(pScreen); - xEvent xCurrentEvent; - ZeroMemory (&xCurrentEvent, sizeof (xCurrentEvent)); - - ErrorF ("winRestoreModeKeyStates ()\n"); - - /* Has the key state changed? */ - if (WIN_XOR(pScreenPriv->dwModeKeyStates & NumLockMask, - GetKeyState (VK_NUMLOCK))) - { - ErrorF ("winRestoreModeKeyStates () - Restoring NumLock\n"); - - xCurrentEvent.u.u.detail = MIN_KEYCODE + VK_NUMLOCK; - - /* Push the key */ - xCurrentEvent.u.u.type = KeyPress; - xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); - mieqEnqueue (&xCurrentEvent); - - /* Release the key */ - xCurrentEvent.u.u.type = KeyRelease; - xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); - mieqEnqueue (&xCurrentEvent); - } - - /* Has the key state changed? */ - if (WIN_XOR(pScreenPriv->dwModeKeyStates & LockMask, - GetKeyState (VK_CAPITAL))) - { - ErrorF ("winRestoreModeKeyStates () - Restoring CapsLock\n"); - - xCurrentEvent.u.u.detail = MIN_KEYCODE + VK_CAPITAL; - - /* Push the key */ - xCurrentEvent.u.u.type = KeyPress; - xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); - mieqEnqueue (&xCurrentEvent); - - /* Release the key */ - xCurrentEvent.u.u.type = KeyRelease; - xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); - mieqEnqueue (&xCurrentEvent); - } - - /* Has the key state changed? */ - if (WIN_XOR(pScreenPriv->dwModeKeyStates & ScrollLockMask, - GetKeyState (VK_SCROLL))) - { - ErrorF ("winRestoreModeKeyStates () - Restoring ScrollLock\n"); - - xCurrentEvent.u.u.detail = MIN_KEYCODE + VK_SCROLL; - - /* Push the key */ - xCurrentEvent.u.u.type = KeyPress; - xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); - mieqEnqueue (&xCurrentEvent); - - /* Release the key */ - xCurrentEvent.u.u.type = KeyRelease; - xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); - mieqEnqueue (&xCurrentEvent); - } - - /* Has the key state changed? */ - if (WIN_XOR(pScreenPriv->dwModeKeyStates & KanaMask, - GetKeyState (VK_KANA))) - { - ErrorF ("winRestoreModeKeyStates () - Restoring KanaLock\n"); - xCurrentEvent.u.u.detail = MIN_KEYCODE + VK_KANA; - - /* Push the key */ - xCurrentEvent.u.u.type = KeyPress; - xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); - mieqEnqueue (&xCurrentEvent); - - /* Release the key */ - xCurrentEvent.u.u.type = KeyRelease; - xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); - mieqEnqueue (&xCurrentEvent); - } -} - /* Called by the WakeupHandler * Processes and/or dispatches Windows messages */ @@ -202,9 +51,9 @@ winWindowProc (HWND hWnd, UINT message, LPCREATESTRUCT pcs; HRESULT ddrval; RECT rcClient, rcSrc; + int iScanCode; - //ErrorF ("winWindowProc () - Message: %d\n", message); - + /* Initialize our event structure */ ZeroMemory (&xCurrentEvent, sizeof (xCurrentEvent)); /* Retrieve screen privates pointers for this window */ @@ -214,11 +63,6 @@ winWindowProc (HWND hWnd, UINT message, pScreenInfo = pScreenPriv->pScreenInfo; pScreen = pScreenInfo->pScreen; } - else - { - ErrorF ("winWindowProc () - Screen privates are null, msg: %d\n", - message); - } /* Branch on message type */ switch (message) @@ -294,8 +138,6 @@ winWindowProc (HWND hWnd, UINT message, &rcSrc, DDBLT_WAIT, NULL); - if (FAILED (ddrval)) - FatalError ("winWindowProc () - DD blt failed\n"); /* Relock the shadow surface */ ddrval = IDirectDrawSurface_Lock (pScreenPriv->pddsShadow, @@ -332,9 +174,6 @@ winWindowProc (HWND hWnd, UINT message, &rcSrc, DDBLT_WAIT, NULL); - if (FAILED (ddrval)) - FatalError ("winWindowProc () - DDNL Blt failed: %08x\n", - ddrval); break; case WIN_SERVER_PRIMARY_DD: @@ -343,7 +182,7 @@ winWindowProc (HWND hWnd, UINT message, We'll have to hand roll the clipping for windowed mode; the performance of the primary fb server is so bad - that it probably won't be work the effort to write + that it probably wouldn't be worth the effort to write the clipping code. */ break; @@ -462,8 +301,9 @@ winWindowProc (HWND hWnd, UINT message, pScreenPriv->iDeltaZ = 0; } - /* Only process this message if the wheel has moved further than - WHEEL_DELTA + /* + Only process this message if the wheel has moved further than + WHEEL_DELTA */ if (iDeltaZ >= WHEEL_DELTA || (-1 * iDeltaZ) >= WHEEL_DELTA) { @@ -474,9 +314,10 @@ winWindowProc (HWND hWnd, UINT message, } else { - /* Wheel has not moved past WHEEL_DELTA threshold; - we will store the wheel delta until the threshold - has been reached. + /* + Wheel has not moved past WHEEL_DELTA threshold; + we will store the wheel delta until the threshold + has been reached. */ pScreenPriv->iDeltaZ = iDeltaZ; return 0; @@ -492,7 +333,11 @@ winWindowProc (HWND hWnd, UINT message, xCurrentEvent.u.u.detail = Button5; } - /* Flip iDeltaZ to positive, if negative */ + /* + Flip iDeltaZ to positive, if negative, + because always need to generate a *positive* number of + button clicks for the Z axis. + */ if (iDeltaZ < 0) { iDeltaZ *= -1; @@ -515,86 +360,18 @@ winWindowProc (HWND hWnd, UINT message, case WM_SYSKEYDOWN: case WM_KEYDOWN: - /* Bail out early if this is a mouse button */ - if (wParam < 0x07 && wParam != VK_CANCEL) - break; - - /* Generic key down */ + winTranslateKey (wParam, lParam, &iScanCode); xCurrentEvent.u.u.type = KeyPress; - - /* There are a couple funny keys */ - switch (wParam) - { - case VK_RETURN: - if (lParam & WIN_KEY_EXTENDED) - xCurrentEvent.u.u.detail = WIN_VK_KP_RETURN + MIN_KEYCODE; - else - xCurrentEvent.u.u.detail = wParam + MIN_KEYCODE; - break; - case VK_MENU: - if (lParam & WIN_KEY_EXTENDED) - xCurrentEvent.u.u.detail = VK_RMENU + MIN_KEYCODE; - else - xCurrentEvent.u.u.detail = VK_LMENU + MIN_KEYCODE; - break; - case VK_CONTROL: - if (lParam & WIN_KEY_EXTENDED) - xCurrentEvent.u.u.detail = VK_RCONTROL + MIN_KEYCODE; - else - xCurrentEvent.u.u.detail = VK_LCONTROL + MIN_KEYCODE; - break; - case VK_SHIFT: - if (lParam & WIN_KEY_EXTENDED) - xCurrentEvent.u.u.detail = VK_RSHIFT + MIN_KEYCODE; - else - xCurrentEvent.u.u.detail = VK_LSHIFT + MIN_KEYCODE; - break; - default: - xCurrentEvent.u.u.detail = wParam + MIN_KEYCODE; - } + xCurrentEvent.u.u.detail = iScanCode; xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); mieqEnqueue (&xCurrentEvent); return 0; case WM_SYSKEYUP: case WM_KEYUP: - /* Bail out early if this is a mouse button */ - if (wParam < 0x07 && wParam != VK_CANCEL) - break; - - /* Generic key up */ + winTranslateKey (wParam, lParam, &iScanCode); xCurrentEvent.u.u.type = KeyRelease; - - /* There are a couple funny keys */ - switch (wParam) - { - case VK_RETURN: - if (lParam & WIN_KEY_EXTENDED) - xCurrentEvent.u.u.detail = WIN_VK_KP_RETURN + MIN_KEYCODE; - else - xCurrentEvent.u.u.detail = wParam + MIN_KEYCODE; - break; - case VK_MENU: - if (lParam & WIN_KEY_EXTENDED) - xCurrentEvent.u.u.detail = VK_RMENU + MIN_KEYCODE; - else - xCurrentEvent.u.u.detail = VK_LMENU + MIN_KEYCODE; - break; - case VK_CONTROL: - if (lParam & WIN_KEY_EXTENDED) - xCurrentEvent.u.u.detail = VK_RCONTROL + MIN_KEYCODE; - else - xCurrentEvent.u.u.detail = VK_LCONTROL + MIN_KEYCODE; - break; - case VK_SHIFT: - if (lParam & WIN_KEY_EXTENDED) - xCurrentEvent.u.u.detail = VK_RSHIFT + MIN_KEYCODE; - else - xCurrentEvent.u.u.detail = VK_LSHIFT + MIN_KEYCODE; - break; - default: - xCurrentEvent.u.u.detail = wParam + MIN_KEYCODE; - } + xCurrentEvent.u.u.detail = iScanCode; xCurrentEvent.u.keyButtonPointer.time = GetTickCount (); mieqEnqueue (&xCurrentEvent); return 0; @@ -714,8 +491,9 @@ winWindowProc (HWND hWnd, UINT message, if (pScreenPriv->fEnabled && pScreen != miPointerCurrentScreen ()) { - /* Tell mi that we are changing the screen that receives - mouse input events. + /* + Tell mi that we are changing the screen that receives + mouse input events. */ miPointerSetNewScreen (pScreenInfo->dwScreen, 0, 0); @@ -773,21 +551,24 @@ winWindowProc (HWND hWnd, UINT message, switch (pScreenInfo->dwEngine) { case WIN_SERVER_SHADOW_GDI: - /* Are we active? - Are we fullscreen? + /* + Are we active? + Are we fullscreen? */ if (pScreenPriv != NULL && pScreenPriv->fActive && pScreenInfo->fFullScreen) { - /* Activating, attempt to bring our window - to the top of the display + /* + Activating, attempt to bring our window + to the top of the display */ ShowWindow (hWnd, SW_RESTORE); } - /* Are we inactive? - Are we fullscreen? + /* + Are we inactive? + Are we fullscreen? */ if (pScreenPriv != NULL && !pScreenPriv->fActive @@ -801,14 +582,16 @@ winWindowProc (HWND hWnd, UINT message, break; case WIN_SERVER_SHADOW_DD: - /* Do we have a surface? - Are we active? - Are we fullscreen? + /* + Do we have a surface? + Are we active? + Are we fullscreen? */ if (pScreenPriv != NULL && pScreenPriv->pddsPrimary != NULL && pScreenPriv->fActive - && pScreenInfo->fFullScreen) + //&& pScreenInfo->fFullScreen + ) { /* Primary surface was lost, restore it */ IDirectDrawSurface_Restore (pScreenPriv->pddsPrimary); @@ -816,14 +599,16 @@ winWindowProc (HWND hWnd, UINT message, break; case WIN_SERVER_SHADOW_DDNL: - /* Do we have a surface? - Are we active? - Are we full screen? + /* + Do we have a surface? + Are we active? + Are we full screen? */ if (pScreenPriv != NULL && pScreenPriv->pddsPrimary4 != NULL && pScreenPriv->fActive - && pScreenInfo->fFullScreen) + //&& pScreenInfo->fFullScreen + ) { /* Primary surface was lost, restore it */ IDirectDrawSurface_Restore (pScreenPriv->pddsPrimary4); diff --git a/xc/programs/Xserver/include/servermd.h b/xc/programs/Xserver/include/servermd.h index dd342e2b4..c1dcc8d98 100644 --- a/xc/programs/Xserver/include/servermd.h +++ b/xc/programs/Xserver/include/servermd.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/servermd.h,v 3.43 2001/01/17 22:36:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/servermd.h,v 3.44 2001/04/12 20:10:00 torrey Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -149,21 +149,6 @@ SOFTWARE. #endif /* __arm32__ */ -#ifdef __DARWIN__ - -#define IMAGE_BYTE_ORDER MSBFirst -#define BITMAP_BIT_ORDER MSBFirst -#define GLYPHPADBYTES 4 -#define GETLEFTBITS_ALIGNMENT 1 - -#define LARGE_INSTRUCTION_CACHE -#define FAST_CONSTANT_OFFSET_MODE -#define PLENTIFUL_REGISTERS -#define AVOID_MEMORY_READ -#define FAST_MEMCPY - -#endif /* __DARWIN__ */ - #if defined(__powerpc__) #define IMAGE_BYTE_ORDER MSBFirst diff --git a/xc/programs/Xserver/mi/Imakefile b/xc/programs/Xserver/mi/Imakefile index 395b74dd6..eee97ad58 100644 --- a/xc/programs/Xserver/mi/Imakefile +++ b/xc/programs/Xserver/mi/Imakefile @@ -3,7 +3,7 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:36 cpqbld Exp $ -XCOMM $XFree86: xc/programs/Xserver/mi/Imakefile,v 3.32 2001/01/17 22:37:05 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/mi/Imakefile,v 3.33 2001/04/23 16:17:12 tsi Exp $ #include <Server.tmpl> @@ -48,8 +48,6 @@ OBJS = $(CBRT_OBJ) mivaltree.o mipolyseg.o mipolyrect.o \ */ EXT_DEFINES = ExtensionDefines -UXINPUT -UXF86VIDMODE -UXFreeXDGA -UXF86MISC \ -UXFree86LOADER -#else -EXT_DEFINES = ExtensionDefines #endif INCLUDES = -I. -I../include -I../../../include/fonts -I../render \ diff --git a/xc/programs/Xserver/mi/mioverlay.c b/xc/programs/Xserver/mi/mioverlay.c index d651d6102..a89b829d2 100644 --- a/xc/programs/Xserver/mi/mioverlay.c +++ b/xc/programs/Xserver/mi/mioverlay.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/mioverlay.c,v 3.8 2000/06/07 22:03:15 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mioverlay.c,v 3.10 2001/04/14 21:15:26 mvojkovi Exp $ */ #include "X.h" #include "scrnintstr.h" @@ -45,7 +45,7 @@ typedef struct { UnrealizeWindowProcPtr UnrealizeWindow; RealizeWindowProcPtr RealizeWindow; miOverlayTransFunc MakeTransparent; - int overlayDepth; + miOverlayInOverlayFunc InOverlay; Bool underlayMarked; Bool copyUnderlay; } miOverlayScreenRec, *miOverlayScreenPtr; @@ -90,9 +90,6 @@ static void miOverlayChangeBorderWidth(WindowPtr, unsigned int); #define IN_UNDERLAY(w) MIOVERLAY_GET_WINDOW_TREE(w) #define IN_OVERLAY(w) !MIOVERLAY_GET_WINDOW_TREE(w) -#define OVERLAY_DEPTH(s) \ - (MIOVERLAY_GET_SCREEN_PRIVATE(s)->overlayDepth) - #define MARK_OVERLAY(w) miMarkWindow(w) #define MARK_UNDERLAY(w) MarkUnderlayWindow(w) @@ -103,12 +100,12 @@ static void miOverlayChangeBorderWidth(WindowPtr, unsigned int); Bool miInitOverlay( ScreenPtr pScreen, - int overlayDepth, + miOverlayInOverlayFunc inOverlayFunc, miOverlayTransFunc transFunc ){ miOverlayScreenPtr pScreenPriv; - if(!overlayDepth || !transFunc) return FALSE; + if(!inOverlayFunc || !transFunc) return FALSE; if(miOverlayGeneration != serverGeneration) { if(((miOverlayScreenIndex = AllocateScreenPrivateIndex()) < 0) || @@ -127,7 +124,7 @@ miInitOverlay( pScreen->devPrivates[miOverlayScreenIndex].ptr = (pointer)pScreenPriv; - pScreenPriv->overlayDepth = overlayDepth; + pScreenPriv->InOverlay = inOverlayFunc; pScreenPriv->MakeTransparent = transFunc; pScreenPriv->underlayMarked = FALSE; @@ -169,10 +166,10 @@ miOverlayCloseScreen(int i, ScreenPtr pScreen) miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); pScreen->CloseScreen = pScreenPriv->CloseScreen; - pScreen->CreateWindow = pScreen->CreateWindow; - pScreen->DestroyWindow = pScreen->DestroyWindow; - pScreen->UnrealizeWindow = pScreen->UnrealizeWindow; - pScreen->RealizeWindow = pScreen->RealizeWindow; + pScreen->CreateWindow = pScreenPriv->CreateWindow; + pScreen->DestroyWindow = pScreenPriv->DestroyWindow; + pScreen->UnrealizeWindow = pScreenPriv->UnrealizeWindow; + pScreen->RealizeWindow = pScreenPriv->RealizeWindow; xfree(pScreenPriv); @@ -191,7 +188,7 @@ miOverlayCreateWindow(WindowPtr pWin) pWinPriv->tree = NULL; - if(!pWin->parent || (pWin->drawable.depth != OVERLAY_DEPTH(pScreen))) { + if(!pWin->parent || !((*pScreenPriv->InOverlay)(pWin))) { if(!(pTree = (miOverlayTreePtr)xcalloc(1, sizeof(miOverlayTreeRec)))) return FALSE; } @@ -293,10 +290,9 @@ miOverlayRealizeWindow(WindowPtr pWin) pScreen->RealizeWindow = miOverlayRealizeWindow; } - /* we only need to cache the root window realization */ + /* we only need to catch the root window realization */ - if(result && !pWin->parent && - (pWin->drawable.depth != pScreenPriv->overlayDepth)) + if(result && !pWin->parent && !((*pScreenPriv->InOverlay)(pWin))) { BoxRec box; box.x1 = box.y1 = 0; @@ -806,7 +802,7 @@ miOverlayValidateTree( REGION_UNINIT(pScreen, &childClip); - if(newParent->drawable.depth != pPriv->overlayDepth) { + if(!((*pPriv->InOverlay)(newParent))) { REGION_INIT(pScreen, &tParent->valdata->exposed, NullBox, 0); REGION_INIT(pScreen, &tParent->valdata->borderExposed, NullBox, 0); } @@ -815,13 +811,13 @@ miOverlayValidateTree( case VTStack: break; default: - if(newParent->drawable.depth != pPriv->overlayDepth) + if(!((*pPriv->InOverlay)(newParent))) REGION_SUBTRACT(pScreen, &tParent->valdata->exposed, &totalClip, &tParent->clipList); /* fall through */ case VTMap: REGION_COPY( pScreen, &tParent->clipList, &totalClip); - if(newParent->drawable.depth != pPriv->overlayDepth) + if(!((*pPriv->InOverlay)(newParent))) newParent->drawable.serialNumber = NEXT_SERIAL_NUMBER; break; } @@ -859,7 +855,7 @@ miOverlayHandleExposures(WindowPtr pWin) while (1) { if((mival = pTree->valdata)) { - if(pTree->pWin->drawable.depth != pPriv->overlayDepth) { + if(!((*pPriv->InOverlay)(pTree->pWin))) { if (REGION_NOTEMPTY(pScreen, &mival->borderExposed)) (*pWin->drawable.pScreen->PaintWindowBorder)( pTree->pWin, &mival->borderExposed, PW_BORDER); @@ -887,7 +883,7 @@ miOverlayHandleExposures(WindowPtr pWin) pChild = pWin; while (1) { if ( (val = pChild->valdata) ) { - if(pChild->drawable.depth != pPriv->overlayDepth) { + if(!((*pPriv->InOverlay)(pChild))) { REGION_UNION(pScreen, &val->after.exposed, &val->after.exposed, &val->after.borderExposed); @@ -1041,6 +1037,7 @@ miOverlayWindowExposures( if (clientInterested && exposures && (REGION_NUM_RECTS(exposures) > RECTLIMIT)) { + miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); BoxRec box; box = *REGION_EXTENTS(pScreen, exposures); @@ -1055,7 +1052,7 @@ miOverlayWindowExposures( /* This is the only reason why we are replacing mi's version of this file */ - if(pWin->drawable.depth != OVERLAY_DEPTH(pScreen)) { + if(!((*pPriv->InOverlay)(pWin))) { miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); REGION_INTERSECT(pScreen, prgn, prgn, &pTree->clipList); } else diff --git a/xc/programs/Xserver/mi/mioverlay.h b/xc/programs/Xserver/mi/mioverlay.h index 51e628ef5..6098f9c39 100644 --- a/xc/programs/Xserver/mi/mioverlay.h +++ b/xc/programs/Xserver/mi/mioverlay.h @@ -1,14 +1,15 @@ -/* $XFree86: xc/programs/Xserver/mi/mioverlay.h,v 3.3 2000/02/29 00:16:03 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mioverlay.h,v 3.4 2001/04/14 21:15:26 mvojkovi Exp $ */ #ifndef __MIOVERLAY_H #define __MIOVERLAY_H typedef void (*miOverlayTransFunc)(ScreenPtr, int, BoxPtr); +typedef Bool (*miOverlayInOverlayFunc)(WindowPtr); Bool miInitOverlay( ScreenPtr pScreen, - int overlayDepth, + miOverlayInOverlayFunc inOverlay, miOverlayTransFunc trans ); diff --git a/xc/programs/Xserver/mi/mipointer.c b/xc/programs/Xserver/mi/mipointer.c index e0fdef104..e5de60692 100644 --- a/xc/programs/Xserver/mi/mipointer.c +++ b/xc/programs/Xserver/mi/mipointer.c @@ -24,7 +24,7 @@ Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/mipointer.c,v 3.6 2001/01/17 22:37:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mipointer.c,v 3.7 2001/04/19 14:14:07 tsi Exp $ */ # define NEED_EVENTS # include "X.h" @@ -90,6 +90,7 @@ miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate) if (!screenFuncs->NewEventScreen) screenFuncs->NewEventScreen = mieqSwitchScreen; pScreenPriv->waitForUpdate = waitForUpdate; + pScreenPriv->showTransparent = FALSE; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = miPointerCloseScreen; pScreen->devPrivates[miPointerScreenIndex].ptr = (pointer) pScreenPriv; @@ -303,6 +304,7 @@ miPointerUpdate () { ScreenPtr pScreen; miPointerScreenPtr pScreenPriv; + CursorPtr pCursor; int x, y, devx, devy; pScreen = miPointer.pScreen; @@ -344,9 +346,10 @@ miPointerUpdate () */ else if (miPointer.pCursor != miPointer.pSpriteCursor) { - (*pScreenPriv->spriteFuncs->SetCursor) (pScreen, - miPointer.pCursor->bits->emptyMask ? - NullCursor : miPointer.pCursor, x, y); + pCursor = miPointer.pCursor; + if (pCursor->bits->emptyMask && !pScreenPriv->showTransparent) + pCursor = NullCursor; + (*pScreenPriv->spriteFuncs->SetCursor) (pScreen, pCursor, x, y); miPointer.devx = x; miPointer.devy = y; diff --git a/xc/programs/Xserver/mi/mipointrst.h b/xc/programs/Xserver/mi/mipointrst.h index e83bb4ac6..9e90c7c6f 100644 --- a/xc/programs/Xserver/mi/mipointrst.h +++ b/xc/programs/Xserver/mi/mipointrst.h @@ -25,7 +25,7 @@ Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/mipointrst.h,v 1.2 2001/03/25 05:32:16 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mipointrst.h,v 1.3 2001/04/19 14:14:07 tsi Exp $ */ #include "mipointer.h" #include "scrnintstr.h" @@ -56,4 +56,5 @@ typedef struct { miPointerScreenFuncPtr screenFuncs; /* screen-specific methods */ CloseScreenProcPtr CloseScreen; Bool waitForUpdate; /* don't move cursor in SIGIO */ + Bool showTransparent; /* show empty cursors */ } miPointerScreenRec, *miPointerScreenPtr; diff --git a/xc/programs/Xserver/os/Imakefile b/xc/programs/Xserver/os/Imakefile index b0ab6d8ec..07c884e83 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.29 2001/01/17 22:37:09 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/os/Imakefile,v 3.31 2001/04/23 16:17:12 tsi Exp $ #include <Server.tmpl> @@ -107,9 +107,7 @@ BOOTSTRAPCFLAGS = #endif DBM_DEFINES = NdbmDefines ADM_DEFINES = -DADMPATH=\"$(ADMDIR)/X\%smsgs\" - EXT_DEFINES = ExtensionDefines XDMCP_DEFINES = ServerXdmcpDefines - OS_DEFINES = ServerOSDefines KRB5_DEFINES = Krb5Defines XALLOC_DEFINES = XallocDefines ERROR_DEFINES = ServerErrorDefines @@ -118,7 +116,7 @@ BOOTSTRAPCFLAGS = #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 - DEPEND_DEFINES = $(DBM_DEFINES) $(XDMCP_DEFINES) $(EXT_DEFINES) $(TRANS_INCLUDES) $(CONNECTION_FLAGS) + DEPEND_DEFINES = $(DBM_DEFINES) $(XDMCP_DEFINES) $(EXT_DEFINES) $(TRANS_INCLUDES) $(CONNECTION_FLAGS) DependDefines LINTLIBS = ../dix/llib-ldix.ln #ifdef NEED_ALLOCA_FROM_LIBPW diff --git a/xc/programs/Xserver/os/WaitFor.c b/xc/programs/Xserver/os/WaitFor.c index a7e5470e6..fbbe80fca 100644 --- a/xc/programs/Xserver/os/WaitFor.c +++ b/xc/programs/Xserver/os/WaitFor.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/WaitFor.c,v 3.29 2001/04/05 19:29:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/WaitFor.c,v 3.30 2001/04/27 12:51:07 alanh Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -144,9 +144,6 @@ WaitForSomething(pClientsReady) { int i; struct timeval waittime, *wt; -#ifdef __CYGWIN__ - struct timeval waittime0, *wt0; -#endif INT32 timeout; #ifdef DPMSExtension INT32 standbyTimeout, suspendTimeout, offTimeout; @@ -342,10 +339,6 @@ WaitForSomething(pClientsReady) #ifdef XTESTEXT1 /* XXX how does this interact with new write block handling? */ if (playback_on) { -#ifdef __CYGWIN__ - waittime.tv_sec = 0; - waittime.tv_usec = 0; -#endif wt = &waittime; XTestComputeWaitTime (&waittime); } @@ -360,14 +353,7 @@ WaitForSomething(pClientsReady) } else { -#ifndef __CYGWIN__ i = Select (MaxClients, &LastSelectMask, NULL, NULL, wt); -#else - waittime0.tv_sec = 0; - waittime0.tv_usec = 10000; - wt0 = &waittime0; - i = Select (MaxClients, &LastSelectMask, NULL, NULL, wt0); -#endif } selecterr = errno; WakeupHandler(i, (pointer)&LastSelectMask); diff --git a/xc/programs/Xserver/os/connection.c b/xc/programs/Xserver/os/connection.c index 8c8397405..4562cf4b2 100644 --- a/xc/programs/Xserver/os/connection.c +++ b/xc/programs/Xserver/os/connection.c @@ -41,7 +41,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/os/connection.c,v 3.45 2001/04/01 14:00:16 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/os/connection.c,v 3.46 2001/04/27 12:51:07 alanh Exp $ */ /***************************************************************** * Stuff to create connections --- OS dependent * @@ -74,9 +74,7 @@ extern int errno; #include <stdio.h> #ifndef WIN32 -#if defined(__CYGWIN__) -#include <cygwin/socket.h> -#elif defined(MINIX) || defined(Lynx) +#if defined(MINIX) || defined(Lynx) #include <socket.h> #else #include <sys/socket.h> @@ -117,7 +115,7 @@ extern __const__ int _nfiles; #if defined(TCPCONN) || defined(STREAMSCONN) # include <netinet/in.h> # include <arpa/inet.h> -# if !defined(hpux) && !defined(__CYGWIN__) +# if !defined(hpux) # ifdef apollo # ifndef NO_TCP_H # include <netinet/tcp.h> @@ -139,7 +137,7 @@ extern __const__ int _nfiles; #include <server/ip/gen/inet.h> #endif -#if !defined(AMOEBA) && !defined(_MINIX) && !defined(__EMX__) && !defined(__CYGWIN__) +#if !defined(AMOEBA) && !defined(_MINIX) && !defined(__EMX__) #ifndef Lynx #include <sys/uio.h> #else @@ -205,7 +203,7 @@ static fd_set SavedClientsWithInput; int GrabInProgress = 0; int *ConnectionTranslation = NULL; -#if defined(WIN32) || defined(__CYGWIN__) +#if defined(WIN32) /* SPAM ALERT !!! * On NT fds are not between 0 and MAXSOCKS, they are unrelated, and there is * not even a known maximum value, so use something quite arbitrary for now. @@ -310,7 +308,7 @@ InitConnectionLimits() ErrorF("InitConnectionLimits: MaxClients = %d\n", MaxClients); #endif -#if !defined(WIN32) && !defined(__CYGWIN__) +#if !defined(WIN32) ConnectionTranslation = (int *)xnfalloc(sizeof(int)*(lastfdesc + 1)); #else ConnectionTranslation = (int *)xnfalloc(sizeof(int)*(MAXFD)); @@ -335,7 +333,7 @@ CreateWellKnownSockets() FD_ZERO(&LastSelectMask); FD_ZERO(&ClientsWithInput); -#if !defined(WIN32) && !defined(__CYGWIN__) +#if !defined(WIN32) for (i=0; i<MaxClients; i++) ConnectionTranslation[i] = 0; #else for (i=0; i<MAXFD; i++) ConnectionTranslation[i] = 0; @@ -380,7 +378,7 @@ CreateWellKnownSockets() if (!XFD_ANYSET (&WellKnownConnections)) FatalError ("Cannot establish any listening sockets - Make sure an X server isn't already running"); -#if !defined(WIN32) && !defined(__CYGWIN__) +#if !defined(WIN32) OsSignal (SIGPIPE, SIG_IGN); OsSignal (SIGHUP, AutoResetServer); #endif @@ -403,7 +401,7 @@ CreateWellKnownSockets() * in the second case, the signal will be quite * useful */ -#if !defined(WIN32) && !defined(__CYGWIN__) +#if !defined(WIN32) if (OsSignal (SIGUSR1, SIG_IGN) == SIG_IGN) RunFromSmartParent = TRUE; ParentProcess = getppid (); @@ -464,7 +462,7 @@ ResetWellKnownSockets () /* * See above in CreateWellKnownSockets about SIGUSR1 */ -#if !defined(WIN32) && !defined(__CYGWIN__) +#if !defined(WIN32) if (RunFromSmartParent) { if (ParentProcess > 0) { kill (ParentProcess, SIGUSR1); diff --git a/xc/programs/Xserver/os/io.c b/xc/programs/Xserver/os/io.c index eeb2507dd..eb117d28b 100644 --- a/xc/programs/Xserver/os/io.c +++ b/xc/programs/Xserver/os/io.c @@ -48,7 +48,7 @@ SOFTWARE. * InsertFakeRequest, ResetCurrentRequest * *****************************************************************/ -/* $XFree86: xc/programs/Xserver/os/io.c,v 3.25 2001/04/01 14:00:16 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/os/io.c,v 3.26 2001/04/27 12:51:07 alanh Exp $ */ #ifdef WIN32 #include <X11/Xwinsock.h> @@ -804,7 +804,7 @@ FlushAllOutput() OsCommPtr oc; register ClientPtr client; Bool newoutput = NewOutputPending; -#if defined(WIN32) || defined(__CYGWIN__) +#if defined(WIN32) fd_set newOutputPending; #endif |